Performance baseline (roadmap P1)

python3 tools/bench.py measures every benchmark, compares it with bench/baseline.json, and exits 1 on a confirmed slowdown of more than 10%. --save records a new baseline. Each figure is the fastest of 7 runs. Anything flagged is re-measured 21 times before it is reported, because single runs on this shared 2-core machine vary by more than 15%.

Baseline (2026-11-26, v0.6)

benchmarktree interpreterIR VM (--vm --reuse --prove)CPython 3VM vs CPython
fib(27)287.5 ms158.7 ms35.6 ms4.5× slower
primes (sieve to 10,000)20.2 ms35.6 ms18.1 ms2.0× slower
json (parse + print + 6 KB round trip)40.0 ms67.7 ms——
raytrace (56×22)121.8 ms95.4 ms——
server (515 requests)54.4 ms64.7 ms——
fbip (tree rebuilt 11×)22.1 ms11.9 ms——

Times are whole-process wall time. They include parsing, type checking, and for the VM, ownership analysis and bounds verification.

Update: unboxing (#41)

benchmarkinterpVMnativeCPythonRustnative vs Rust
fib(27)286.2 ms156.0 ms2.3 ms34.0 ms2.3 ms1.0×
primes12.7 ms23.7 ms1.5 ms13.8 ms1.3 ms1.2×
json41.2 ms65.6 ms3.9 ms———
raytrace133.2 ms82.7 ms1.7 ms———
server54.3 ms61.6 ms3.4 ms———
fbip22.5 ms11.3 ms1.7 ms———

Larger workloads: fib(32) runs in 12 ms vs 10 ms in Rust (1.2×) vs 236 ms in CPython. A sieve to 3,000,000 runs in 23 ms vs 20 ms in Rust (1.15×) vs 492 ms in CPython.

Update: native backend (#23)

tools/bench.py now also builds each benchmark natively (only execution is timed) and compiles Rust versions of fib and primes. On these short programs process startup (about 1 ms) is a large part of every number:

benchmarkinterpVMnativeCPythonRust
fib(27)283.2 ms172.6 ms3.0 ms33.9 ms1.8 ms
primes18.1 ms23.2 ms1.4 ms14.3 ms1.2 ms
json39.5 ms65.6 ms3.1 ms——
raytrace121.5 ms84.6 ms3.1 ms——
server53.4 ms61.0 ms2.8 ms——
fbip22.7 ms12.1 ms1.8 ms——

On larger workloads, where startup doesn't hide anything: fib(32) runs in 20 ms native vs 10 ms in Rust vs 238 ms in CPython. A sieve to 3,000,000 runs in 118 ms vs 21 ms vs 483 ms. See docs/NATIVE.md for why the sieve gap is memory layout, and what fixes it.

Reading it honestly (v0.6 numbers, before the native backend)