text speeds are good

Colin Holgate coiin at rcn.com
Sun Mar 16 12:18:52 EDT 2008


While pondering David's performance questions (that I see he has  
solved), I did a test of how quickly Rev deals with long strings.  
Those can be slow in some cases, Director in particular, and so I  
tested Rev against Director with Lingo, Director with Javascript, and  
Flash with Actionscript 3. Here's the routine for both Rev and for  
Director:

on filltext
   put the milliseconds into ms
   put "" into t
   repeat with a = 1 to 30000
     put "aaaaaaaaaaaaaaaaaaaaaaa" after t
   end repeat
   put the milliseconds - ms && the number of chars in t
end filltext

Apart from anything else it shows how Talk like Lingo can be! The  
results were somewhat shocking though, Director (admittedly running  
under Rosetta) took over 18 seconds as Lingo, and over 44 seconds as  
Javascript.

Rev takes 10 milliseconds to do the same thing. Flash, with AS3, and  
this routine:

filltext();
function filltext() {
    var d1:Date = new Date();
    var ms:int = d1.getTime();
    var t:String = "";
    for (var i = 0; i<30000; i++) {
       t += "aaaaaaaaaaaaaaaaaaaaaaa";
    }
    var d2:Date = new Date();
    var nms:int = d2.getTime()
    trace(nms - ms, t.length);
}

takes 5 milliseconds. I increased the loops to 300,000 to see more  
exactly the timing, and Rev became 263 milliseconds, and AS3 was 70.  
For completeness I tried AS2 as well, and that was 310 milliseconds  
(for the 300,000 loop).

So, although Rev isn't anywhere near as fast as AS3 at handling text  
strings, it is significantly faster than AS2, and a lot faster than  
Director running under Rosetta. I realized I had a way to test it not  
under Rosetta (can't tell you how, I'd have to kill you!), and the  
300,000 loop as Lingo came out at 436 milliseconds, making Rev almost  
twice the speed of Director 11, when it comes out.





More information about the use-livecode mailing list