6 ms·
LuaJIT 2.0 intellectual property disclosure (2009)
- vortico 11y agoThis is an interesting summary of the technology used in LuaJIT.
- technomancy 11y agoEven more valuable when you consider that Pall has stepped down as head of LuaJIT dev and handed off maintainership to others.
- pikachu_is_cool 11y agoHe's still head. He hasn't found a suitable replacement yet.
- technomancy 11y agoOh interesting. I heard that CloudFlare was going to take over, but that may just have been about "we will handle paying the salary of the right person once they are found".
- bungle 11y agoThe current situation is that 2.1 (currently in beta) is finished with Mike on the board, and after that Mike is "out".
- malkia 11y agoIs that even possible? :)
- Scarbutt 11y agoIs Lua easier to optimize than Javascript? Is impressive how fast LuaJIT is for being a one man show.
- PeCaN 11y agoYes. While they have very similar semantics, Lua is just simpler. (ES6 though goes way beyond and is probably quite a bit harder to optimize simply because of having much more surface area.) Of course, most of LuaJIT is applicable to JS as well. Mike Pall simply implemented it better than whole teams at Google and Mozilla. Yeah. Dude's pretty smart.
- blaisio 11y agoI think typical ES6 code is actually less likely to use parts of JavaScript that are difficult to optimize because we now have a lot of features that let us be more clear about our intentions. Proxy objects are probably more difficult to deal with, but the rest of ES6 is probably easy to take advantage of.
- djrenren 11y agoAs smart as Mike Pall is, it isn't just that he's some crazy genius. Lua lacks a mutable prototype chain which can really spoil javascript performance and optimizability. As far as I can tell you can't something like: Array.prototype[0] = 5; and make [] the same as [5]. There's a lot of edge cases in javascript that make its optimization much more complicated than lua's.
- Twisol 11y agoYou can create a prototype chain in Lua by associating an object with a metatable that has an __index metamethod. If the table that __index references has a metatable itself, the chain continues. http://www.lua.org/pil/13.4.1.html http://www.lua.org/pil/13.4.1.html Importantly, `tbl[key]` only consults `__index` if `key` isn't actually a key in `tbl`, so keys in derived objects override keys up the prototype chain.
- david-given 11y agoAlso in Lua you can change the prototype of constructed objects, by just calling setmetatable() on them again; while in Javascript you can't --- once the object's been constructed, that's it. http://stackoverflow.com/questions/7015693/how-to-set-the-prototype-of-a-javascript-object-that-has-already-been-instantiat http://stackoverflow.com/questions/7015693/how-to-set-the-pr... I ran into this a little while back while trying to port some Lua code to Javascript. It was very annoying.
- nickik 11y agoAs somebody writting a VM that is simular to LuaJit as a hobby project, I have read this document over and over again. There are so many interesting ideas and approches.
- david-given 11y agoNaN tagging is really neat --- in LuaJIT, all values are stored as doubles; pointers are encoded as a NaN with the pointer part embedded in the NaN data field (you get about 50 bits to play with). The beauty is that NaNs propagate; you can perform a complex numeric operation on them, and then test the result once while you're finished. If it's a NaN, then you know that one of the operands must have been a NaN and you escape back to the JIT for more analysis. If it's not... then it worked, and you just continue. And testing for a NaN is cheap.
- clisp1 11y agoNaN tagging exists since the dawn of time. CDC 6600 had reserved NaN mantissa bits... in 1963! The IEEE floating point standard just carried on these features. Many lisp implementation used NaN for packing data in the 80's/90's. Google for: lisp nan tagged data.
- malkia 11y agoLuaJIT is great, and with the real fast and easy to use FFI it makes you design, prototype, test, and write real applications dealing with lots of "C" libraries much much easier. I think the only real drawback, and maybe its being worked on (haven't checked the project in several months) is the internal memory limit of the lua heap (has to be below the first addressable 4GB's).
- thechao 11y agoFor those of us who are disbarred from looking at, or researching, IP: this is a statement by the owner placing this IP into the equivalent of the US public domain, or its equivalent in your state. The code is under MIT license. The author, obviously, doesn't indemnify you. If you're unfamiliar with the genius of the FFI in Lua, or Mike Pall's JIT/VM wizardry, it is well worth looking at.