From 114bd3d2b0e8fc625a39c8791298bf2e090f303f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 6 Oct 2026 13:43:36 -0600 Subject: [PATCH 1/6] Step 1: Run every build on one machine, with the reference in between The results site can only compare idioms inside one Ruby today: each Ruby runs as its own CI job on its own machine, so i/s across Rubies is mostly the machine. script/run_cross_ruby.rb runs every build of a shard's files on one machine, one after the other, so their i/s can be compared. The builds come from the rake matrix in benchmarks.yml, so a Ruby added to CI is measured here too. The newest released MRI is the reference: it runs first, again after every 3 builds, and last. It is the same code every time, so its passes show how steady the machine was during the run. A Ruby's interpreter and JIT builds run back to back, so each image is fetched once and removed after its last pass (with --fresh-images, in CI), which keeps the runner's disk free. The collector records the shard, the pass, whether it is the reference and when each report finished; those fields are empty for the regular CI jobs. --- compose.yaml | 5 ++ docker/collect_results.rb | 7 ++ script/run_cross_ruby.rb | 157 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 script/run_cross_ruby.rb diff --git a/compose.yaml b/compose.yaml index 224c282..24723c4 100644 --- a/compose.yaml +++ b/compose.yaml @@ -21,6 +21,11 @@ x-benchmark: &benchmark - RESULTS_LABEL - RESULTS_COMMIT - RESULTS_PR + # Cross-Ruby runs only (script/run_cross_ruby.rb). + - RESULTS_SHARD + - RESULTS_SHARDS + - RESULTS_PASS + - RESULTS_REFERENCE - GITHUB_RUN_ID - GITHUB_RUN_ATTEMPT - RUNNER_NAME diff --git a/docker/collect_results.rb b/docker/collect_results.rb index 00ee82e..9d642fc 100644 --- a/docker/collect_results.rb +++ b/docker/collect_results.rb @@ -52,6 +52,13 @@ def write(report) "run_id" => env("GITHUB_RUN_ID"), "run_attempt" => env("GITHUB_RUN_ATTEMPT"), "runner" => env("RUNNER_NAME"), + # Set by script/run_cross_ruby.rb, which runs every build on one machine and the reference build between them; nil otherwise. + "shard" => env("RESULTS_SHARD") && env("RESULTS_SHARD").to_i, + "shards" => env("RESULTS_SHARDS") && env("RESULTS_SHARDS").to_i, + "pass" => env("RESULTS_PASS") && env("RESULTS_PASS").to_i, + "reference" => env("RESULTS_REFERENCE") == "1", + # When this report finished, to place it between the reference passes. + "measured_at" => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"), "environment" => environment, "entries" => report.data })) diff --git a/script/run_cross_ruby.rb b/script/run_cross_ruby.rb new file mode 100644 index 0000000..566b22f --- /dev/null +++ b/script/run_cross_ruby.rb @@ -0,0 +1,157 @@ +# Runs every build on this one machine, one after the other, so their i/s can be compared (the "Across Rubies" view of the results site): +# +# ruby script/run_cross_ruby.rb [--shard 0 --shards 6] [options] +# +# The reference build (the latest stable MRI) runs first, again after every few builds, and last. +# It is the same code every time, so its passes show how steady the machine was during the run. +# Each pass writes its results to /pass-NN/