perf(benchmarks): add cross-runtime fib(35) benchmark package#41
Conversation
Adds a separate Go module at benchmarks/ that benchmarks recursive fib(35) against six runtimes: native Go, wazero (WASM JIT), minivm (threaded), tengo, gopher-lua, and goja. Structure: benchmarks/go.mod – standalone module; replace => ../ for local dev benchmarks/programs.go – exported Fib(n) program builder for minivm benchmarks/fib_test.go – BenchmarkFib35 cross-runtime comparison The main module packages carry no dependency on this module. Run via: cd benchmarks && go test -bench=. -benchmem ./... Or: make benchmark (Makefile cd-into-benchmarks target) https://claude.ai/code/session_01JB2vNud87x733SUgB4BJMz
- Update environment header from 2.80 GHz to 2.10 GHz
- Add running commands for benchmarks/ cross-runtime module
- Update cross-runtime fib(35) table with fresh 5s measurements:
native 56 ms · wazero 85 ms · minivm 1.32 s · tengo 2.28 s
gopher-lua 3.00 s · goja 3.96 s
- Revise interpreter ratios: minivm 1.7× tengo, 2.3× gopher-lua, 3.0× goja
- Update all scalar/control/variable/call throughput numbers (~17–34 ns)
- Split ref section into integer-ref (22–29 ns) and string-ref (81–93 ns)
- Add string operations table (107–305 ns)
- Replace old heap-object numbers with fresh measurements:
array.new_default 58–63 ns · struct.new_default 54 ns · map.new 187 ns
- Change recursive section to fib(20)=856 µs, factorial(10)=501 ns;
cross-link to cross-runtime table for fib(35)
- Update JIT note: x86-64 fallback is ~2× threaded cost
- Update methodology to mention benchmarks/ as a separate Go module
https://claude.ai/code/session_01JB2vNud87x733SUgB4BJMz
PR Review Summary — Cross-Runtime fib(35) Benchmark PackageThis PR has been correctly merged. It is focused, well-implemented, and architecturally sound. Merge Readiness Assessment: ✅ PASSScope Control: Pass — focused on benchmarking infrastructure only; no changes to core minivm packages or unrelated cleanup. Correctness: Pass — all six runtimes (native Go, wazero, tengo, gopher-lua, goja, minivm) correctly implement fib(35) recursive descent. WASM binary is properly formatted. Context management and error handling are correct. Test Coverage: Pass — BenchmarkFib35 benchmark with six sub-benchmarks covers the new feature. Proper benchmark methodology: initialization outside timed loop, b.ReportAllocs() / b.ResetTimer() used correctly. Architecture Consistency: Pass — separate Go module at Risk & Compatibility: Pass — zero breaking changes; no new dependencies for main minivm packages; existing benchmarks unaffected. Maintainability: Pass — clear, well-commented code. WASM binary structure documented. Key Strengths
Minimal Path to MergeNo changes required — PR was correctly merged. Generated by Claude Code |
Adds a separate Go module at benchmarks/ that benchmarks recursive fib(35)
against six runtimes: native Go, wazero (WASM JIT), minivm (threaded),
tengo, gopher-lua, and goja.
Structure:
benchmarks/go.mod – standalone module; replace => ../ for local dev
benchmarks/programs.go – exported Fib(n) program builder for minivm
benchmarks/fib_test.go – BenchmarkFib35 cross-runtime comparison
The main module packages carry no dependency on this module.
Run via: cd benchmarks && go test -bench=. -benchmem ./...
Or: make benchmark (Makefile cd-into-benchmarks target)
https://claude.ai/code/session_01JB2vNud87x733SUgB4BJMz