3 ms·
When running Lua, always consider running it on the LuaJIT (http://luajit.org/ http://luajit.org/). It's extremely fast, portable and lightweight JIT compiler f
by fosk 11y ago
When running Lua, always consider running it on the LuaJIT (http://luajit.org/ http://luajit.org/). It's extremely fast, portable and lightweight JIT compiler for Lua, although it only supports Lua 5.1.
The performance improvements are incredible, and it allows you to write inline C code thanks to the FFI library (declaring it like this https://github.com/Mashape/kong/blob/master/kong/plugins/file-log/handler.lua#L21-L25 https://github.com/Mashape/kong/blob/master/kong/plugins/fil..., and invoking it like this https://github.com/Mashape/kong/blob/master/kong/plugins/file-log/handler.lua#L53 https://github.com/Mashape/kong/blob/master/kong/plugins/fil...)
- aleksi 11y agoThere are some Lua 5.2 extensions: http://luajit.org/extensions.html http://luajit.org/extensions.html
- vbit 11y agoSeconded. LuaJIT FFI is just awesome. Check out the motivating examples: http://luajit.org/ext_ffi.html http://luajit.org/ext_ffi.html BTW, does anyone have recent benchmarks comparing LuaJIT against new versions of the Javascript JITs?
- CapsAdmin 11y agoYou are restricted to making C declarations. You can't write inline C code. You can however can create and use C types in Lua.