News for hackers. Stuff that matters.
Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by ardit33 on Friday March 12, 2010 @08:26PM (#1188264)
how are they very different? Syntax aside, Lua and Javascript are actually pretty similar. I would say they actually are close cousins.
Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by olliej on Saturday March 13, 2010 @01:00AM (#1188565)
One of the big issues is that any JS function can technically walks its own call stack, which makes inlining very difficult, and for many of these tests the ability to inline is actually a fairly substantial advantage.

The basic problem faced by a JS engine is that if it wants to be able to inline a function it has to be able to either:

* Prove that it knows everything that the function may do -- in effect this means you can't inline any functions that themselves call functions, or any functions that interact with any values you can't consider constant, or identify before you enter the inlined code; or

* Have the ability to at any point in time reconstruct the call stack, and all arguments correctly.

One of these choices is exceedingly limiting in what you can do, and the other is vastly complex.

Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by sjs on Saturday March 13, 2010 @02:48AM (#1188662)
As Mike Pall said: "None of the benchmarks make use of JavaScript's weird corners. And all of them can (or could) be reduced to simple constructs. So I wouldn't blame it on the language differences alone (maybe on the implementation)."

Only the use of such a feature should trip the "do it the safe but slow way" switch. Maybe that's not possible here though, I don't know that much about compiler optimization.

edit: I'm not implying it's easy either, but if it's possible the V8 team has the skills to implement it.

Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by beagle3 on Saturday March 13, 2010 @04:45AM (#1188746)
But 99.9% of JS code doesn't do that, so it should be optimized for that case.

LuaJIT keeps enough info around to go back to the interpreter at the moment anything goes different than previously traced -- I see no reason JS couldn't do the same.

Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by extension on Friday March 12, 2010 @09:04PM (#1188309)
Indeed, they are strikingly similar, one of the key differences being Lua's minimal/extensible dispatch. A function call, by default, involves no searching through superclasses/prototypes. This is likely a big advantage in benchmarks.
Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by xtho on Saturday March 13, 2010 @12:23AM (#1188535)
Which subclasses do you want to search through in JavaScript?

That said to me lua seems a little bit like JavaScript's sane cousin.

Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by tumult on Friday March 12, 2010 @11:21PM (#1188467)
JavaScript has multiple critical blunders in its specification that offer no advantage to the programmer, but are very difficult to optimize.
Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by kinetik on Friday March 12, 2010 @11:12PM (#1188457)
They really are quite different. Here's one example: http://lambda-the-ultimate.org/node/3851#comment-57751
Re:"LuaJIT's interpreter () beats V8's JIT compiler" - Mike ... by xtho on Saturday March 13, 2010 @12:25AM (#1188536)
Define "quite different".