Repository navigation
CodSpeed: report the median of each row, keep unstable rows informational - #31
Merged
Ivo Horák (horakivo) merged 5 commits intoNov 30, 2026
Merged
Conversation
…onal CodSpeed compares the fastest round of a row. On rows where a few iterations run without a garbage collection, that round says little about the others, and a change that halves the median can show as a regression. codspeed-bench now gives CodSpeed one value per timed row, the median of the second half of its iterations, in every round, the way it already reports peak RSS. walltime-summary.json still keeps every iteration's duration. Rows whose speed differs between builds or processes of the same source are listed in INFORMATIONAL in codspeed-bench, each with its reason. They are measured and kept in walltime-summary.json and on the summary page, in a section of their own, but not reported to CodSpeed. --list marks them. codspeed-diagnose selects from every suite of the walltime job (--suite) and fails when --bench selects nothing or when no option set measured a row.
- The diagnose job needs a status function in its condition: the CPython job, an ancestor through check, is skipped in GraalPy mode. - codspeed-diagnose removes an option set's earlier summary before measuring it. - codspeed-bench checks --interpreter against the interpreter only when reporting.
Ivo Horák (horakivo)
marked this pull request as ready for review
November 30, 2026 00:03
Ivo Horák (horakivo)
merged commit Nov 30, 2026
5ec7ff4
into
bench/cpython-baseline
12 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #28 (
bench/cpython-baseline); the diff shows only this change.1. CodSpeed gets the median, not the fastest iteration
CodSpeed compares the fastest round of each row. On rows where a few iterations run without a garbage collection (the orjson rows before their fix: fastest 0.52 s, median 2.9 s), a change that halves the median could show as a 60% regression.
codspeed-benchnow uploads one value per timed row: the median of the second half of the iterations, the same statistic asmedian_nsinwalltime-summary.json. It goes in every stats field (min_ns=median_ns=max_ns=mean_ns,stdev_ns0,rounds= number of samples). This is the shape the peak RSS rows already use (single_value_stats, whichmemory_statsnow calls). With--interpreter cpython(4 iterations) it is the median of the last two, the same rule the summary uses.--listURIs are byte-identical to the base).walltime-summary.jsonis unchanged: every iteration indurations_s, plus the full statistics of the second half. It gains one key,informational.memoryare unchanged.Expect on the first run: every guarded row is compared with the base branch's fastest iteration, so the first report shows most rows as slower (median ≥ fastest). Comparisons are like for like from the next base-branch run on.
2. Informational rows: measured, not reported
INFORMATIONALincodspeed-bench(next toSKIP) mapssuite/nameto a one-line reason. The rows are defined in upstream'smx_graalpython_bench_param.py, which the fork does not edit, so the marker lives in the driver. To report a row again, delete its line.An informational row is:
measuredinwalltime-summary.json, with its reason underinformational;--listmarks informational rows. A warning is printed if a key ofINFORMATIONAL,SKIPorCPYTHON_SKIPno longer names a benchmark.Marked rows:
meso/euler31meso/euler11meso/pidigits,meso/parrot-b2meso/mandelbrot3meso/chaos-sized2meso/binarytrees3micro-native/c-many-shortlived-objs3. Diagnose
codspeed-diagnose --suitenow defaults to every suite of the walltime job (micro-native meso packages interp startup memory), sobenchcan select any row, informational rows included.codspeed-bench --listfirst, also in--preflight(so thecheckjob fails on the pool), and fails when nothing is selected.README and workflow comments are updated.
Verified locally (correctness only, no timing)
--listover all six suites: the 8 rows are marked, with no warnings. URIs are identical to the base branch.--interpreter cpython --max-iterations 4,CODSPEED_PROFILE_FOLDERset, one row temporarily made informational:median_ns= the median ofdurations_s[2:];memory/idlestill has two entries (time and peak RSS);measured, ininformational, and in its own section ofwalltime-summary.md.codspeed-diagnosewith a GraalPy 25.6.5 release:interp/richards3andmemory/idlepass;--benchexits 1, also with--preflight;--bench euler31selects the meso row.Only a run on the benchmark host can verify
Review
Changes from the review, on top of this PR and the interpreter switch it is stacked on:
codspeed-diagnoseremoves an option set's earlier summary before measuring it, so a rerun into the same directory cannot report an earlier run.codspeed-benchchecks--interpreteragainst the interpreter only when reporting to CodSpeed; a local run needs no--interpreter, and its summary records the interpreters its rows ran on. The probe tolerates an interpreter that cannot be started.Declined nit: a pattern that selects only the one skipped row passes the pre-check; the run then fails with nothing measured.
Reviewed with sol-loop: 5 rounds with gpt-6.2-sol. Sol verdict: approved
🤖 Generated with Claude Code