Skip to content

CodSpeed: report the median of each row, keep unstable rows informational - #31

Merged
Ivo Horák (horakivo) merged 5 commits into
bench/cpython-baselinefrom
bench/guard-set-median
Nov 30, 2026
Merged

Ivo Horák (horakivo) merged 5 commits into
bench/cpython-baselinefrom
bench/guard-set-median

Conversation

@horakivo

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

Copy link
Copy Markdown
Member

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-bench now uploads one value per timed row: the median of the second half of the iterations, the same statistic as median_ns in walltime-summary.json. It goes in every stats field (min_ns = median_ns = max_ns = mean_ns, stdev_ns 0, rounds = number of samples). This is the shape the peak RSS rows already use (single_value_stats, which memory_stats now calls). With --interpreter cpython (4 iterations) it is the median of the last two, the same rule the summary uses.

  • Row names are unchanged (--list URIs are byte-identical to the base).
  • walltime-summary.json is unchanged: every iteration in durations_s, plus the full statistics of the second half. It gains one key, informational.
  • The peak RSS rows of memory are 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

INFORMATIONAL in codspeed-bench (next to SKIP) maps suite/name to a one-line reason. The rows are defined in upstream's mx_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:

  • still measured;
  • kept under measured in walltime-summary.json, with its reason under informational;
  • shown in a separate section of the summary page, with the reason;
  • not written to the CodSpeed results.

--list marks informational rows. A warning is printed if a key of INFORMATIONAL, SKIP or CPYTHON_SKIP no longer names a benchmark.

Marked rows:

Row Reason
meso/euler31 three levels (1.5, 2.4, 3.6 s), decided per process
meso/euler11 1.5 or 2.3 s, decided per build
meso/pidigits, meso/parrot-b2 two levels, decided per build, flip together
meso/mandelbrot3 three levels, decided per build
meso/chaos-sized2 0.83 or 1.28 s, decided per build
meso/binarytrees3 3.2 to 3.7 s, decided per build
micro-native/c-many-shortlived-objs 24.5 s or 27 to 31 s on identical code

3. Diagnose

  • codspeed-diagnose --suite now defaults to every suite of the walltime job (micro-native meso packages interp startup memory), so bench can select any row, informational rows included.
  • It checks the selection with codspeed-bench --list first, also in --preflight (so the check job fails on the pool), and fails when nothing is selected.
  • It fails when no option set measured a row. A set whose rows all failed still gets its tables.

README and workflow comments are updated.

Verified locally (correctness only, no timing)

  • --list over all six suites: the 8 rows are marked, with no warnings. URIs are identical to the base branch.
  • CPython 3.13, --interpreter cpython --max-iterations 4, CODSPEED_PROFILE_FOLDER set, one row temporarily made informational:
    • the guarded row's result file has min = median = max = the summary's median_ns = the median of durations_s[2:];
    • memory/idle still has two entries (time and peak RSS);
    • the informational row has no result file, but is in measured, in informational, and in its own section of walltime-summary.md.
  • Synthetic orjson-shaped durations (fastest 0.52, median 2.9): the uploaded value is 2.9.
  • codspeed-diagnose with a GraalPy 25.6.5 release:
    • two option sets on interp/richards3 and memory/idle pass;
    • an empty --bench exits 1, also with --preflight;
    • all sets failing exits 1;
    • --bench euler31 selects the meso row.

Only a run on the benchmark host can verify

  • That CodSpeed accepts and shows the single value per row (the median s on the summary page should match CodSpeed's value).
  • That informational rows drop out of the CodSpeed report.
  • The full walltime and diagnose jobs end to end.

Review

Changes from the review, on top of this PR and the interpreter switch it is stacked on:

  • The diagnose job has a status function in its condition; without it the job was skipped in GraalPy mode, because the CPython job it depends on through the check job is skipped there.
  • codspeed-diagnose removes an option set's earlier summary before measuring it, so a rerun into the same directory cannot report an earlier run.
  • codspeed-bench checks --interpreter against 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

…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.
@horakivo
Ivo Horák (horakivo) marked this pull request as ready for review November 30, 2026 00:03
@horakivo
Ivo Horák (horakivo) merged commit 5ec7ff4 into bench/cpython-baseline Nov 30, 2026
12 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