mix lua.bench (Lua v1.0.0-rc.2)

View Source

Runs one of the Benchee scripts in benchmarks/.

Contributor-only task

This task is intended for development of the :lua library itself. It is not shipped to Hex: it shells out to mix run under MIX_ENV=benchmark, which requires Benchee/Luerl/luaport deps that only exist in this repo's mix.exs, and it reads from benchmarks/, which is not part of the Hex package.

Each script is a standalone .exs file that already compares this VM against Luerl (and C Lua via :luaport when available). The task is a convenience wrapper that

  • discovers the available workloads from benchmarks/*.exs,
  • re-runs each under MIX_ENV=benchmark (the Benchee, Luerl, and luaport deps are gated to that env in mix.exs),
  • forwards the child process's stdout/stderr.

Usage

mix lua.bench                          # run all workloads (quick mode)
mix lua.bench --workload fibonacci     # run one
mix lua.bench --list                   # print available workloads
mix lua.bench --workload fibonacci --workload closures
                                       # run several
LUA_BENCH_MODE=full mix lua.bench      # long runs + memory_time + n-sweep

Options

  • --workload NAME — Workload to run (basename of a file under benchmarks/, without the .exs). May be repeated; if omitted, every workload is run.
  • --list — Print the available workloads and exit.

Run modes

The benchmark scripts read the LUA_BENCH_MODE environment variable (see benchmarks/helpers.exs):

  • default (quick) — short Benchee windows (1 s warmup, 3 s measurement, memory_time off) for fast development iteration. Each workload takes ~16 s; the full suite is ~80 s wall clock.
  • full — long windows (2 s warmup, 10 s measurement, memory time on) plus a sweep of multiple input sizes for the table workloads. Use this for any numbers you publish (PR descriptions, ROADMAP.md). Each workload takes a minute or two; the full suite runs ~15+ minutes.

Notes

This task shells out to mix run in the :benchmark env so the Benchee/Luerl/luaport deps are available. If mix deps.get hasn't been run in that env, the child process will print Mix's standard "could not find dependency" error.