Skip to content

TypedPython benchmarks: harness for CPython / Node / Java / Rust - #28

Merged
b-re-w merged 3 commits into
developfrom
work/typedpython-bench
Oct 3, 2026
Merged

b-re-w merged 3 commits into
developfrom
work/typedpython-bench

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Closes #24 — the baseline is now measured on an idle machine (see the last commit and results/2026-10-03-*.json).

Feature added

benchmarks/typedpython/ contains five programs, each implemented in typed Python, Node, Java and Rust:

  • nbody
  • spectral-norm
  • fannkuch-redux
  • binary-trees
  • wordfreq (dict-heavy)

All implementations print byte-identical results. A sixth column, TypedPython @compiled, prints n/a (not built) until M2 delivers the compiler.

The runner has two commands:

  • python3 run.py verify checks that all implementations agree at small sizes.
  • python3 run.py measure [--repeat N] [--write] reports the median of N runs. It prints uptime first, refuses to run above load 4.0 unless --force is given, and writes results/<date>-<host>.json only with --write.

Test added / verification

  • run.py verify exits 0 and all 5 benchmarks agree. Re-run by the coordinating session.
  • The known Benchmarks Game values for spectral-norm 100 and fannkuch 7 match.
  • With a fake interpreter, verify exits 1 and flags every benchmark.
  • The typed Python passes the TypedPython gate in --mode compiled: exit 0, no diagnostics.

Not done

No results are committed. The load average stayed between 11 and 48 for the whole session, so the numbers would not mean anything (AGENTS.md §8).

… Rust)

Five programs (nbody, spectral-norm, fannkuch-redux, binary-trees, and a
dict-heavy word-frequency count), each in gate-clean typed Python, Node, Java
and Rust, all printing identical results. run.py verify checks agreement;
run.py measure refuses to run above load 4.0 and writes results only with
--write. The @compiled column reports n/a until the backend exists.

No results are committed: the machine was at load 40+ throughout.

Refs #24
b-re-w added 2 commits October 3, 2026 12:06
Median of 5, wall time, measured alone at load 1.60/1.55/1.47 (a first run at
load 3.1 agreed within ~3%):

| benchmark | CPython | Node | Java | Rust |
|---|---|---|---|---|
| nbody 1e6 | 4.143 s | 0.130 s | 0.187 s | 0.061 s |
| spectral-norm 800 | 3.441 s | 0.076 s | 0.116 s | 0.027 s |
| fannkuch-redux 10 | 6.196 s | 0.271 s | 0.269 s | 0.261 s |
| binary-trees 16 | 3.938 s | 0.172 s | 0.163 s | 0.266 s |
| wordfreq 3e6 | 2.509 s | 0.972 s | 0.343 s | 0.164 s |

Java includes JVM startup, excludes javac. @compiled column: not built yet.

Closes #24
With --typedpython <dir> (and --typedpython-python for the compile step),
each benchmark is copied with the module marker, compiled by
typedpython.pipeline, and its main() runs from the built extension. verify
includes the column in the agreement check; benchmarks with nothing compiled
report n/a. verify: all 5 agree.

Refs #24, #41
@b-re-w
b-re-w merged commit d143417 into develop Oct 3, 2026
5 checks passed
@b-re-w
b-re-w deleted the work/typedpython-bench branch October 3, 2026 10:13
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