Skip to content

perf(benchmarks): add cross-runtime fib(35) benchmark package#41

Merged
siyul-park merged 2 commits into
mainfrom
claude/benchmark-reusable-package-YOBny
May 25, 2026
Merged

perf(benchmarks): add cross-runtime fib(35) benchmark package#41
siyul-park merged 2 commits into
mainfrom
claude/benchmark-reusable-package-YOBny

Conversation

@siyul-park

Copy link
Copy Markdown
Owner

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

claude added 2 commits May 25, 2026 09:48
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
@siyul-park siyul-park merged commit 50899e0 into main May 25, 2026
5 checks passed

Copy link
Copy Markdown
Owner Author

PR Review Summary — Cross-Runtime fib(35) Benchmark Package

This PR has been correctly merged. It is focused, well-implemented, and architecturally sound.

Merge Readiness Assessment: ✅ PASS

Scope 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 benchmarks/ with correct replace => ../ directive prevents main package dependency and maintains clean layer boundaries.

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. Fib(n) function exported for reuse. Documentation comprehensive.

Key Strengths

  1. Architectural Isolation: Benchmark infrastructure properly isolated in separate module, avoiding bloat in main packages.

  2. Accurate Methodology: Fair cross-runtime comparison — each runtime initialized once outside timed loop, same fib(35) algorithm across all runtimes.

  3. Zero Integration Risk: Makefile change is minimal. No main module modifications required.

  4. Complete Documentation: docs/benchmarks.md updated with new benchmark results, clear run instructions, and methodology notes.

Minimal Path to Merge

No changes required — PR was correctly merged.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants