text speeds are good
Dave Cragg
dave.cragg at lacscentre.co.uk
Sun Mar 16 15:48:17 EDT 2008
On 16 Mar 2008, at 18:46, Colin Holgate wrote:
>
> filltext();
> function filltext() {
> var d1:Date = new Date();
> var ms:int = d1.getTime();
> var t:String = "";
> var w:String;
> for (var i = 0; i<300000; i++) {
> t += "aaaaaaaaaaaaaaaaaaaaaab";
> }
> var tarray:Array = t.split("ab");
> for (i = 0; i<tarray.length; i++) {
> w = tarray[i];
> }
> var d2:Date = new Date();
> var nms:int = d2.getTime();
> trace(nms - ms, t.length);
> }
As I said, I used a regEx delimiter for the split. The following is
what I think is the equivalent of Rev's "each word" structure.
var d1:Date = new Date();
var ms:int = d1.getTime();
var t:String = "";
var w:String;
var rx:RegExp = /\s/;
for (var i:int = 0; i<300000; i++) {
t += "aaaaaaaaaaaaaaaaaaaaaa ";
}
var tarray:Array = t.split(rx);
for (i = 0; i<tarray.length; i++) {
w = tarray[i];
}
var d2:Date = new Date();
var nms:int = d2.getTime();
trace(nms - ms, t.length);
On my machine, it's about 10 times slower than using a simple string
as the delimiter.
> In any case, I was trying to praise Rev's handling of something
> that can be potentially slow, and not trying to find the fastest
> way that it could be done.
I know. And I was interested in your data. But you did make the
statement "Rev isn't anywhere near as fast as AS3 at handling text
strings" which could have been misinterpreted. I just wanted to point
out that it might depend on what you are doing.
Cheers
Dave
More information about the use-livecode
mailing list