Everyone knows that V8 is faster than most other Javascripts, but it's less well known how it compares for raw speed against other scripting languages. I like to run languages through my own comparative speed tests once a year to see howthey evolve, and Lua has had no close rivals in recent years. But take a look now:
<pre> ----------------------------------------------------------- Execution times for recursive F/P factorial(n) to /dev/null Langs @ 2008 Times: n=1 n=170 difference ----------------------------------------------------------- C 0.000 ms 0.090 ms 0.090 ms Lua 0.001 s 0.005 s 0.004 s Parrot-opt/iterative 0.013 s 0.018 s 0.005 s Parrot/iterative 0.014 s 0.019 s 0.005 s V8-Javascript 0.007 s 0.013 s 0.006 s Ocaml 0.022 s 0.029 s 0.007 s Python 0.013 s 0.027 s 0.014 s Parrot-opt/recursive 0.013 s 0.029 s 0.016 s Mozilla-Javascript 0.001 s 0.018 s 0.017 s Perl 0.002 s 0.021 s 0.019 s Nickle 0.031 s 0.065 s 0.034 s Parrot/recursive 0.014 s 0.056 s 0.042 s Ruby 0.041 s 0.095 s 0.054 s Lua_on_Parrot 0.303 s 1.314 s 1.011 s ----------------------------------------------------------- </pre> (If Google Groups input didn't honour my <pre> tags above, sorry ... I hope the table is still readable. :P) Ignoring my tests of Parrot PIR using VM assembly code and the baseline reference provided by C and Ocaml, it seems that Lua now has a speed rival, as the difference of 1ms in this noddy test is in the noise and not significant. Since V8 is still undergoing optimization, I think that this augers very well for the future of V8 in the speed demon race. :-) It's worth noting that this is going to make V8 extremely popular in the game scripting arena, where Lua currently reigns supreme, and it will also generate great interest in an "official" conversion of the basic V8 shell program into a proper commandline language and utility. Morgaine. --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
