Lunacy is a Rust implementation of Lua 5.1. It doesn't contain a compiler frontend, and instead parses dumped bytecode from PUC Lua.
Lunacy, unlike most other Rust Lua implementations, contains a Just-In-Time compiler. It uses Lazy Basic Block Versioning in order to specialize bytecode operations based on runtime types, and then uses DynASM-rs for a template JIT for those specialized operations. The LBBV specializer implements table shape optimization, which allows for most Lua functions to use O(1) table key accesses. This scheme is mostly novel, but is based on LuaJIT's hash slot specialization modified to be usable for a non-tracing JIT.
The normal interpreter mode for Lunacy is unfortunately fairly slow currently (~3x slower than PUC Lua). However the JIT, with the unsafe feature enabled to skip runtime bounds checks plus the skip_rc feature to replace our current Rc<T> garbage collection with "leak everything", is able to run slightly faster than PUC Lua on nbody.
We use just for workflow automation.
just testwill run some simple self-tests fromdump.luafor quick language semantics validation.just run <bench>will run the given benchmark using the release profile.just hyperfine <bench>will generate a hyperfine report for the given benchmark with PUC Lua, the interpreter-only mode of Lunacy, thereleaseprofile, and anunsafeprofile (which disables bounds checking for some structures).just flamegraph <bench>will generate acargo-flamegraphperformance report. Lunacy supports emitting a perf map file so it can track JIT times, although the lack of frame pointers means its not very good.