Some of you may know that Google have just release Chrome, their new, open sourced, BSD licensed web browser. It comes with a very shiny new Javascript engine called V8, that allegedly has all kinds of performance enhancing features. Some of you may also know that I wrote this C compiler thing called Clue that targets Lua and Javascript. I've taken a copy of the old Whetstone benchmark, translated it to the appropriate language with Clue, and ran them in each configuration. This gives us a ballpark figure allowing us to compare Lua and Javascript. Here are the results pseudo-NWIPS 760 theoretical maximum (static compilation with gcc) 140 Lua via LuaJIT 91 Javascript via V8 33 Lua via Lua interpreter 10 Javascript via SpiderMonkey 9.1 Javascript via Rhino 1.7 Perl 5 via Perl 5 Now, my Lua code emits GOTO opcodes, while the Javascript code has to emulate them with switch statements, so Lua gets to cheat slightly, but I can't estimate how much. LuaJIT still wins, but V8 is definitely catching up --- it's a mere 106kloc too, which competes quite nicely with LuaJIT's 28kloc... -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ "All power corrupts, but we need electricity." --- Diana Wynne Jones, │ _Archer's Goon_
Attachment:
signature.asc
Description: OpenPGP digital signature