You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(vm): drop +16 register buffer on interpreter :call path #312
Fibonacci (recursive) is 1.18× slower than luerl (1.23s vs 1.04s in benchmarks/fibonacci.exs).
Internal signal: benchmarks/dispatcher_vs_interpreter.exs shows the
dispatcher path running fib(25) 1.20× faster than the interpreter. The
dispatcher allocates exactly max(max_registers, param_count) per frame
(lib/lua/vm/dispatcher.ex:1375-1381); the interpreter allocates +16
extra slots per frame (lib/lua/vm/executor.ex:978-979):
For fib(28) (~1.4M frames), those 16 extra slots per frame are pure
allocation churn.
Change
lib/lua/vm/executor.ex:978-979.
Audit the call sites that historically required the buffer (multi-return
inline expansion into the callee's register window). Then either:
a) Prove codegen reports honest peak register usage (matching the
dispatcher's codegen contract) and remove the buffer entirely.
b) Keep a much smaller buffer (2–4) gated on is_vararg / known
multi-return callees only.
The dispatcher already runs with no buffer, which establishes the safety
argument for at least the dispatcher-eligible subset.
Verification
Fullmix test — miss-sized callee tuples manifest as runtime errors,
not static failures.
Lua 5.3 official suite runner (whatever script is canonical).
mix run benchmarks/fibonacci.exs
mix run benchmarks/dispatcher_vs_interpreter.exs — gap should close,
not invert.
Expected
Noticeable share of the 1.18× fib gap and the closures-benchmark gap.
Activity
perf(vm): count > and >= destinations in max_registers backstop
perf(vm): unify register sizing on honest max_registers
perf(vm): self-policing max_registers backstop; drop main-chunk buffer
perf(vm): derive max_registers backstop from one rule; drop main-chun…