Commit bb75b1f
committed
ci: integrate CodSpeed continuous benchmarking
Wire the existing criterion benches into CodSpeed (https://codspeed.io)
for continuous performance tracking. CodSpeed runs benches under CPU
simulation in CI and posts per-PR comparison reports vs. the base
branch's latest main run.
Highlights
==========
- `criterion` workspace dependency renamed to
`codspeed-criterion-compat`: a drop-in passthrough that wraps real
criterion when running outside cargo-codspeed, so bench source code
needs no changes (`use criterion::*` keeps working) and `cargo bench`
locally is unaffected.
- Two workflows:
- `.github/workflows/codspeed.yml` runs on every push to main and
populates the base-branch baseline.
- `.github/workflows/codspeed-pr.yml` runs on PRs when a `bench:*`
label is attached, so external contributors don't blindly burn
CI capacity. Labels are namespaced per crate:
bench:all # whole workspace
bench:arrow # all of arrow's benches
bench:parquet bench:arrow-cast # union
- Sharded one job per `[[bench]]` target (~78 shards after exclusions).
Required because (a) the full workspace produces >1000 individual
benchmarks per upload, and (b) the parquet crate alone produces >1000
due to heavy criterion parameterization, both of which exceed
CodSpeed's per-upload limit. Jobs in the same workflow are
auto-aggregated by CodSpeed into a single report.
Ref: https://codspeed.io/docs/features/sharded-benchmarks
- Build-once / run-many topology:
setup ─┐
├──→ bench (matrix, N shards)
build ─┘
`build` does the full-workspace `cargo codspeed build` exactly once
and uploads `target/codspeed/` as a tar artifact (tar preserves the
+x bit, which `actions/upload-artifact` strips otherwise). Each
bench shard downloads the artifact and invokes
`cargo codspeed run -p <crate> --bench <bench>`. No rebuild per
shard, so CI cost scales with N shards × ~2 min instead of ×10 min.
- Dynamic matrix: `setup` parses every workspace member's Cargo.toml
for `[[bench]]` entries with awk + jq and emits a JSON `{crate,
bench}` array, so new bench targets are picked up automatically
without touching the workflow.
- Auth: GitHub OIDC. No `CODSPEED_TOKEN` secret needed for the public
repo; the workflow's `id-token` claim is what CodSpeed verifies.
Exclusions
==========
Ten bench targets currently fail at runtime (e.g. `merge_kernels`
panics in `arrow-data/src/transform/primitive.rs:31`); these are
pre-existing issues in the benches themselves, not the integration.
They're listed in an `EXCLUDED_BENCHES` env in both workflows so the
remaining ~78 shards run clean. Each excluded target should be fixed
and removed from the list one by one.
Prerequisites for activation
============================
- Install the CodSpeed GitHub App on `apache/arrow-rs`:
https://github.com/apps/codspeed
- Enroll the repository at https://codspeed.io
(the OIDC integration is automatic for public repos; no secret
token configuration required)
Once both are done, the first push to main will populate the baseline
and PRs labeled `bench:*` will receive automated CodSpeed comparison
comments.1 parent 2b2a95a commit bb75b1f
5 files changed
Lines changed: 547 additions & 70 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
0 commit comments