Get the top HN stories in your inbox every day.
shaggie76
The real tragedy of JIT for games is you can't use it on consoles (AFAIK it's always been forbidden as a threat to security). I'm not sure what the rules are for mobile but I'd be surprised if Apple allowed it either.
monocasa
Yeah, iOS doesn't allow JITs except for javascriptcore.
MaxBarraclough
I believe you're permitted to write a JIT that uses JavaScriptCore as its backend. This presumably includes WebAssembly.
MBCook
And it’s speculated for the same reason.
They’ve loosened up on interpreters, which is nice, but there is no way to make a JIT.
stevefan1999
...add that to code generation part which means you will have to run a mini compiler + mini linker for each JIT program you run...how wasteful the CPU cycles and how power inefficient that would be
pjmlp
Unless it is an OS service like on Android, Inferno, Oberon, or the big iron computers from IBM and Unisys (where I agree power consumption isn't that relevant).
Which cache the generated code between runs, unless the original code changes, avoid each application shipping their own mini-JIT toolchain, and on Android's case AOT compile the application using the PGO data gathered by the JIT (also shared via PlayStore to other devices), when the device is idle and charging.
mananaysiempre
I’m a bit puzzled by the author’s statement that they’re building a method-at-a-time JIT here.
Sure, that’s an interesting thing you can do and get a Lua JIT, but I don’t see how that is going to be close to the original, tracing LuaJIT, where much of the simplicity (AFAICT) comes from how it creatively punts on several hard backend problems: optimizing in the presence of complex control flow (an linear sequence possibly followed by a loop, that’s all you get on the lowest level), tricky monomorphization decisions (the types you traced are the types you codegen for), eliminating allocations (exiled to trace exits as much as possible), etc.
sillysaurusx
Where did you learn that? I’ve been wanting to understand LuaJIT for years, but never got around to it.
Is there a “Heart of LuaJIT” style implementation somewhere? Something that’s like a thousand lines but conveys the core ideas.
bch
I think Mike Pall wrote up a whitepaper with the gory details years ago, but I can’t find it atm.
sillysaurusx
Damn. If you find anything related to it, I’ll happily Venmo you $20. (High roller, I know.)
The magic of making Lua so fast is seriously underrated. I’m fascinated why Lua in particular seems to be so amenable to speedups vs, say, Python bytecode or even Elisp bytecode.
undefined
HexDecOctBin
> our implementation of the Lua table uses hidden class, instead of a naive hash table as in Lua/LuaJIT.
What is "hidden class"? Is this a data structure?
inglor
The optimization is usually called shapes outside of JS.
The idea is that shapes (we represent objects like C like structs and not hash maps) are used for relatively non-dynamic objects and then we keep the shape metadata on functions themselves (inline caches) which means property access becomes just a byte offset.
albntomat0
In languages with dynamic properties on objects, it’s a data structure that keeps track of which properties are present, and how to access them.
Short example In JavaScript: Var a = {}; a.b = 15;
The hidden class object a maps the property b to where its stored, may include type information, etc.
Heliodex
Very interesting to see how it performs against LuaJIT and standard Lua. Would love to see some metrics of it against Luau too.
candrewlee14
It’s important to note too that the performance comparison is for the interpreters (not using JIT).
undefined
VWWHFSfQ
I would recommend calling your project something else. ie, not LuaJIT.
avaldez_
I'd call it Jaunatis (new moon in Lithuanian). A word play on Lua (moon in Portuguese).
ketralnis
Agreed, this has the same "neovim: literally the future of vim" smell to it
skorpeon87
NeoVim devs earned that 'Neo' by rapidly adding features that were in demand for years (and were subsequently implemented in Vim, in response to NeoVim's new pace of innovation.
Anyway, adding Neo was enough to differentiate the two names, so what's the problem? Let's not forget that Vim did the same thing to Vi when it was named "Vi IMproved."
ketralnis
It's not the name in the neovim case, it's the tagline "literally the future of vim" when vim was still being actively developed by a different group. It is IMO immoral for me to start a site called "Hacker News 2.0: The successor to Hacker News" and start telling people that I'm the next version of it and that's how that comes off to me.
HellsMaddy
Neovim was a fork of Vim so it makes sense to keep the name similar, this project seems to be a completely new codebase.
mdaniel
There was a similar comment in the other thread (https://news.ycombinator.com/item?id=33712759) with the outstanding (IMHO) suggestion of "Lua DeeJIT" as a nod to the Deegen framework it uses
undefined
Get the top HN stories in your inbox every day.
Recent thread: https://news.ycombinator.com/item?id=33711583