5 ms·
Seeing all the problems and wrong assumptions they had, makes me appreciate luajit even more. 100x smaller, multiple times faster and did it right from the beg
by rurban 10y ago
Seeing all the problems and wrong assumptions they had, makes me appreciate luajit even more.
100x smaller, multiple times faster and did it right from the beginning.
- scriptproof 10y agoThat is irrelevant. On a typed and mostly static language all is 100x easier to compile too.
- throwawayish 10y agoJavaScript is typed as well.
- NiLSPACE 10y agoLua is a dynamic language though.
- scriptproof 10y agoYou are right. What is the magic formula to make the JIT so fast?
- pjako 10y agoJavascript has some features that makes it hard to be JITed. For example it has no fixed object layout. If you are interested into how language design impacts performance this is worth reading: http://wren.io/performance.html http://wren.io/performance.html
- readittwice 10y agoTo be fair it probably also helped that Lua is a simpler language and therefore easier to optimize. A tracing JIT also has an inherent downside: the infamous example of an if in an inner loop with roughly the same probability for the then and else branch. That said LuaJIT is an impressive piece of software. Would love to know what Mike Pall is up to now.
- Nemcue 10y agoAfaik it's so complex it can't keep up with Lua though.
- beagle3 10y agoIt could easily keep up with Lua if Mike Pall agreed with the changes made to Lua, but he didn't. The Lua ecosystem is very different than almost any other; It's primary use case, probably 95% of projects using it or more, is being embedded into another project for scripting/configuration/control. As such, it is common for projects to pick a version of Lua and stick with it, rather than upgrade to the latest-and-greatest-with-slight-to-major-incompatibilities. Pall liked 5.2, and thought 5.3 didn't offer enough to break compatibility.
- curveship 10y ago> multiple times faster You sure about that? In the alioth benchmarks, v8 wipes the floor with lua: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=node&lang2=lua http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...
- pygy_ 10y agoThat's not LuaJIT
- curveship 10y agoAh, my bad. Are you aware of any benchmarks comparing v8 to LuaJIT? Looks like LuaJIT got removed from the alioth site (?).
- igouy 10y ago6 years ago. "If you're interested in something not shown on the benchmarks game website then please take the program source code and the measurement scripts and publish your own measurements." Like this guy did -- https://pybenchmarks.org/u64q/which-programs-are-fastest.php https://pybenchmarks.org/u64q/which-programs-are-fastest.php
- mraleph 10y ago> multiple times faster This is an unsubstantiated claim. If LuaJIT was indeed multiple times faster on arbitrary code, everybody would be just running JS on something like LuaJIT in browsers :) LuaJIT does spectacular job on loops, especially if you limit yourself to number crunching and FFI. But if you code is polymorphic, makes heavy use of normal OOP and does not decompose into a graph of biased loops and linear traces V8 will pull ahead due to its method-compiler nature which is not susceptible to tracing pitfalls. Here is an interesting example: there is an issue[1] "Metatable/__index specialization" in LuaJIT repository filed by Mike Pall himself, it's about adding infrastructure which would allow traces to make optimistic assumptions about metatable constness, because it would greatly improve the quality of traces produced from OOP heavy code. (Also this is precisely the limitation that is already imposed on FFI metatypes to allow JIT generate better code). The issue is still unimplemented in LuaJIT... However this is something that V8 could do for several years now, because it is extremely important for the kind of code people are writing in the real world. [1] https://github.com/LuaJIT/LuaJIT/issues/41 https://github.com/LuaJIT/LuaJIT/issues/41