Skip to content

CodSpeed: interpreter switch for a CPython baseline - #28

Merged
Ivo Horák (horakivo) merged 3 commits into
developfrom
bench/cpython-baseline
Nov 30, 2026
Merged

Ivo Horák (horakivo) merged 3 commits into
developfrom
bench/cpython-baseline

Conversation

@horakivo

@horakivo Ivo Horák (horakivo) commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Lets elide-codspeed.yml run the same benchmarks on CPython, so that CodSpeed can compare CPython with GraalPy row by row. CodSpeed only compares a row with the same row of the base branch. The comparison is therefore a run of this workflow on CPython in a pull request that is never merged ("CPython baseline for CodSpeed (do not merge)", branch bench/cpython). On its report every GraalPy row of develop is set against the same row on CPython.

What changes

  • Switch: DEFAULT_INTERPRETER: graalpy near the top of the workflow, plus the input interpreter for manual runs.
    • A new job config picks the interpreter.
    • It refuses cpython on pushes, on develop and on elide-*.x, so CPython times never become those branches' history. It also refuses cpython together with diagnose.
    • With graalpy the workflow measures exactly as before: same rows, same arguments and iteration counts.
  • With cpython:
    • The GraalPy build and the wheel build are skipped.
    • A new pool job, cpython, installs CPython and downloads PyPI's wheels for the versions in packages/requirements.txt. The benchmark host installs them with package-venv without a network, as for GraalPy.
    • walltime runs at most four iterations per row (--max-iterations 4), because the sizes are chosen for GraalPy's compiled code. The second half is still what is reported. The job timeout is 240 minutes instead of 120.
  • Which CPython: cpython-3.13.17-linux-x86_64-gnu, the latest 3.13 build that uv offers. Python 3.13 is the version this GraalPy implements (PY_VERSION "3.13.14" in its patchlevel.h). It is a python-build-standalone build with PGO and LTO, installed by uv 0.13.5; uv pins the build and checks its hash. CPython's experimental JIT is compiled in but off, as in CPython's default (--enable-experimental-jit=yes-off).
    • check and walltime print sys.version and CONFIG_ARGS.
    • They fail if CPython's major.minor is not the version in GraalPy's patchlevel.h, or if --enable-optimizations or --with-lto is missing, because a slower CPython would make GraalPy look better than it is.
  • codspeed-bench --interpreter graalpy|cpython:
    • cpython leaves out the GraalPy options of the suite interp, so those rows measure CPython's interpreter on the same small sizes.
    • It skips the rows listed in CPYTHON_SKIP with a reason. The table is empty for now: every row ran on a local CPython except c-arith-binop, which only hit my local timeout (it is slow, not broken).
    • In both modes it refuses to run if sys.implementation.name of the interpreter is not the one named.
    • walltime-summary.json gets two new keys, interpreter and skipped. The existing keys are unchanged.
  • Packages: PyPI's numpy links OpenBLAS, while the numpy built for GraalPy uses numpy's own fallback routines. numpy-vectorized therefore compares different libraries.
  • .github/elide/README.md gets a section "CPython baseline".

Checks

  • Locally, pass/fail only (no timings):
    • On CPython 3.12.15 (the first version of this change): every micro-native, interp, startup, memory and packages row ran, including the result checks. The exception is c-arith-binop, which hit my local timeout.
    • On a downloaded GraalPy release: interp, startup, memory and the three C API rows of check ran with --interpreter graalpy.
    • On CPython 3.13.17: the 3.13 wheels of all 11 pinned packages install offline. The packages, interp, startup and memory rows and the three C API rows of check run. The version check accepts 3.13.17 and rejects 3.12.
    • meso was not run on CPython locally.
    • actionlint reports no problems.
  • On the benchmark host: not measured in GraalPy mode. The validation run was cancelled to free the single runner, and perf:bench was removed. The GraalPy path changes only in that the jobs pass --interpreter graalpy and the interpreter is unpacked in a shared step; the rows, arguments and iteration counts are the same.

Also in this branch

#31 was merged into this branch: one reported value per row (the median of the second half of the iterations), eight unstable rows kept informational, and fixes to the diagnose job. Its description has the details and the review changes.

A GraalPy-mode run of the combined change on the benchmark host passed: 82 rows measured with unchanged names, none failed, 8 informational.

Reviewed with sol-loop: 5 rounds with gpt-6.2-sol. Sol verdict: approved

🤖 Generated with Claude Code

elide-codspeed.yml gets an interpreter switch: DEFAULT_INTERPRETER at the
top of the file (graalpy) or the input "interpreter" of a manual run. With
graalpy the workflow measures as before. With cpython it skips the GraalPy
and wheel builds, installs a pinned python-build-standalone CPython 3.12
(PGO and LTO) with uv and PyPI's wheels of the pinned package versions, and
runs the same benchmarks with the same row names and arguments, so that
CodSpeed compares CPython with GraalPy on the base branch. CPython runs are
refused on pushes and on develop and elide-*.x.

codspeed-bench gets --interpreter: cpython leaves out the GraalPy options of
the suite interp and skips the rows of CPYTHON_SKIP, and both modes check
sys.implementation.name of the interpreters they run. The summary gets the
keys "interpreter" and "skipped".
@horakivo Ivo Horák (horakivo) added the perf:bench Runs walltime bench on our infra label Nov 29, 2026
@horakivo Ivo Horák (horakivo) removed the perf:bench Runs walltime bench on our infra label Nov 29, 2026
GraalPy implements Python 3.13 (PY_VERSION in its patchlevel.h). The
CPython build is now cpython-3.13.17-linux-x86_64-gnu, and check and
walltime compare its version with patchlevel.h instead of a fixed 3.12.
…onal (#31)

Each timed row reports one value to CodSpeed, the median of the second half of its iterations; walltime-summary.json keeps every iteration. Eight rows that land on different speeds for identical source are measured and listed in the summary but not reported. codspeed-diagnose selects rows of all suites and fails when nothing was measured; the diagnose job runs when the CPython job is skipped.
@horakivo
Ivo Horák (horakivo) marked this pull request as ready for review November 30, 2026 00:04
@horakivo
Ivo Horák (horakivo) merged commit 07d4590 into develop Nov 30, 2026
34 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