LuaJIT is such an amazing just-in-time compiler, faster than the traditional Lua compiler, supported on many platforms and used everywhere where speed and performance are a priority.
For example it's being used in Redis to provide Lua scripting, and can also be used with nginx (OpenResty). While developing Kong (https://github.com/Mashape/kong) we noticed that LuaJIT provided substantial performance improvements.
I hope that the recent step down of the main committer won't affect the future of the project [1].
Mike Pall is more than just the main committer: he's the designer, practically speaking the author. He's done a lot to advance the state of the art in tracing compiling.
It's fascinating to compare LuaJIT's implementation to the huge complexity and resulting lengthy compile times of the JIT compiler built into LLVM. Mike learned a lot from Smalltalk, IIRC.
I'm kinda sad that this means we probably won't get to see his four-color garbage collector[0]. That's a great link, taught me a lot about garbage collection in general.
We decided to use Lua because we are leveraging OpenResty [1]. It took a while to setup the development environment, since there aren't many big, public, projects based on OpenResty + Lua, but we are on a good track now.
Lua is a very simple language, no batteries included, that's easy to learn and actually quite fun to write. It also has a package manager called Luarocks [2] (that Kong is sponsoring too). The ecosystem is still relatively young, but it's growing - and that's also thanks to tools like LuaJIT.
The author informs that the stack is "difficult bit to wrap your head around first", then makes a bizarre statement "Once again – pushed values are indexed with negative, function arguments with positive numbers." This is not correct, you can use positive or negative indexes in either case. Positive indexes are absolute and negative are relative to the top of the stack.
Yes you're right, I just hoped that this may be a useful mnemonic (admittedly maybe a confusing one, but worked for me) for people starting with Lua. A simplification. How the index with negative offset is computed is explained in detail in the linked PIL/"The Stack" then. From my experience, the most common errors for beginners are 1-based indexing and stack manipulation.
8 comments
[ 3.4 ms ] story [ 24.2 ms ] threadI've seen entire game logic done in 200kb on platforms that had less than 32mb of total CPU memory.
For example it's being used in Redis to provide Lua scripting, and can also be used with nginx (OpenResty). While developing Kong (https://github.com/Mashape/kong) we noticed that LuaJIT provided substantial performance improvements.
I hope that the recent step down of the main committer won't affect the future of the project [1].
[1] http://www.freelists.org/post/luajit/Looking-for-new-LuaJIT-...
It's fascinating to compare LuaJIT's implementation to the huge complexity and resulting lengthy compile times of the JIT compiler built into LLVM. Mike learned a lot from Smalltalk, IIRC.
I'm kinda sad that this means we probably won't get to see his four-color garbage collector[0]. That's a great link, taught me a lot about garbage collection in general.
[0] http://wiki.luajit.org/New-Garbage-Collector
That all said, CloudFlare is good hands to put the project in, and I foresee good things in store for it.
Just curious as to why you chose Lua, and what your experience with it was.
Lua is a very simple language, no batteries included, that's easy to learn and actually quite fun to write. It also has a package manager called Luarocks [2] (that Kong is sponsoring too). The ecosystem is still relatively young, but it's growing - and that's also thanks to tools like LuaJIT.
[1] http://openresty.org/
[2] https://luarocks.org/
[0] https://github.com/neomantra/redis/tree/luajit