Skip to content

bench: compute-bound benchmark harness with hand-written Python baselines - #4

Merged
simontreanor merged 1 commit into
mainfrom
bench-harness
Jul 18, 2026
Merged

bench: compute-bound benchmark harness with hand-written Python baselines#4
simontreanor merged 1 commit into
mainfrom
bench-harness

Conversation

@simontreanor

Copy link
Copy Markdown
Owner

Measurement infrastructure for the ROADMAP "Performance beyond CPython" scoping (also included here): three compute-bound benchmarks, each as a .pyfun program paired with a hand-written Python baseline as the ceiling reference, and a wall-clock runner.

  • expr_eval — builds/simplifies/evaluates ADT expression trees (allocation + nested pattern matching): 2.37x vs hand-written
  • collatz — recursive arithmetic (function-call + integer throughput): 1.18x
  • map_build — 500k string-keyed Map inserts through the fold pass, then 500k lookups: 1.64x

bench/run.py: median of N after a warmup, spread reported, refuses to report timings unless both sides print byte-identical output; --python selects the interpreter (GraalPy/PyPy later), --skip-compile reuses bench/out/*.py for hand-edited experiments (mypyc). Wall-clock only, no call-graph profilers, per the fold-pass postmortem in ROADMAP.

All inputs LCG-derived: deterministic, no data files. Numbers above from CPython 3.14.6 on the dev machine, release compiler at HEAD.

https://claude.ai/code/session_011PBhfjrzsUtwupYtJtzAWu

…ines

Three benchmarks (expr_eval: ADT trees + nested matching; collatz:
call/integer throughput; map_build: fold-pass dict lowering + lookups), each
paired with the Python a Pythonista would write by hand as the ceiling
reference. bench/run.py times both sides wall-clock (median of N after a
warmup, spread reported, byte-identical-output check); --python selects the
interpreter so the same harness measures GraalPy/PyPy/mypyc variants later.
Also records the ROADMAP "Performance beyond CPython" scoping this serves,
with CPython 3.14.6 status quo: expr_eval 2.37x, collatz 1.18x,
map_build 1.64x vs hand-written.

Claude-Session: https://claude.ai/code/session_011PBhfjrzsUtwupYtJtzAWu
@simontreanor
simontreanor merged commit 972208b into main Jul 18, 2026
11 checks passed
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.

1 participant