text speeds are good

Dave Cragg dave.cragg at lacscentre.co.uk
Sun Mar 16 14:27:28 EDT 2008

On 16 Mar 2008, at 16:18, Colin Holgate wrote:

> although Rev isn't anywhere near as fast as AS3 at handling text  
> strings

I think that has to be qualified. Recently I built a routine in AS3  
that had to parse through each word in a text file. I'd previously  
built something similar in Rev. Although it's very likely I haven't  
optimized the AS3 code very well, Rev appeared to run much faster  
than AS3.

In Rev I used the "repeat for each word" structure which spoils us  
somewhat. In AS3 I first parsed the string into an array using   
array.split() and then looped through the array.

The split was very slow. (I split on a regular expression delimiter,  
which may have caused the slowness. But it was the equivalent of what  
Rev does with "for each word") For a 76K file with 13,000 words it  
took 1900+ms to make the array. Looping though the array takes about  

In Rev, the whole thing takes less than 300ms.

However, the comparison isn't scientific as I'm doing different  
things in the loops because of language differences. If I have time,  
I'll try and construct a fairer test.

I don't want to start a language war here. I've been using AS3 for a  
while and am generally impressed. This was the first time I'd seen a  
speed difference that was enough to affect my perception as a user.


More information about the Use-livecode mailing list