Repository navigation
feat(benchmarks): add oven-sh/mimalloc (Bun) as a fifth allocator row (#325) - #330
Merged
Merged
Conversation
Adds `bun-mimalloc` to `allocator-lock.json`, pinned to oven-sh/mimalloc `b20b60d959093b1bc0e24306ec72ccacb3e46fb9` (the `bun-dev3-v2` tip as of 2026-09-03) with its archive sha256. It is built by the same cmake-ninja recipe as `upstream-mimalloc` (Release, static-only, MI_OPT_ARCH=OFF, MI_OPT_SIMD=ON, -O3 -fno-omit-frame-pointer) so the comparison is apples to apples; Bun's tree carries no MI_PPROF option, so that one flag is absent rather than set to OFF, and the row's feature options record pprof/memory-events as not-applicable. Bun's public `mi_*` surface is upstream's, so `native/adapter_mimalloc.c` compiles against its headers unchanged — no dedicated adapter is needed. Everywhere the suite assumed four allocators is now five: the id arrays in orchestration/validate/latency/memory/scaling, the block permutation and near-balanced rotation, the ordinal bounds, the comparison-key arity, the provenance counts, the JSON schemas, and the synthetic fixtures. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
`build_benchmark_allocators.py` now builds `bun-mimalloc` from the lock like any other row: the archive is checksummed before extraction, the pin is required to stay at `bun-dev3-v2@b20b60d9`, and the mimalloc option comparison additionally asserts that Bun's build flags are exactly the upstream flags minus the MI_PPROF option Bun's tree does not carry. A mis-hashed archive fails the build; it is never skipped. `benchmark_report.py` grows a fifth palette entry, a fifth scaling series colour, and a fifth legend row, and every remaining four-allocator assumption (block permutations, ordinal bounds, latency matrix sizes, memory pair completeness) is now derived from `ALLOCATOR_IDS`. Bar rows were re-pitched so five fit the existing panel geometry. The checked-in report fixtures gain the Bun row, and `ci/tests/test_build_benchmark_allocators.py` adds issue #325's positive control: flipping the locked digest makes `download_archive` raise and leaves nothing on disk, proven against a local file:// tarball so it needs no network. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
Comment and input-description only; both workflows already drive the allocator set from the lockfile. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
Adds the pinned-sources table (row id, legend label, pin, build) to docs/benchmarks.md, states that all three mimalloc rows share one cmake recipe and that MI_PPROF is the only intended difference, and records the pin-bump policy. README's Performance section names Bun's fork and says plainly that the charts are regenerated by the scheduled dashboard run, so a freshly added row appears there first. Also records why the README's hole-purging chart stays an off/on measurement: its committed SVGs, CSV and report JSON are one measured artifact set, so a third series means re-measuring on the reference machine, not editing the renderer. No measured five-row numbers are claimed here; none have been produced yet. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
Adding a fifth allocator would otherwise have turned the first published run red twice over. The `benchmark-stats` branch still holds history rows recorded with four allocator identities, and `latest.json`'s optional memory, latency and scaling sections are measured on their own schedules and carried forward onto later core envelopes -- so the first five-row throughput run would have carried four-row sections into a five-row envelope. `ALLOCATOR_ID_LINEAGES` now lists every accepted allocator set, oldest first, exactly as `SCALING_THREAD_POINT_LINEAGES` already does for the thread points: a report is checked against the set it declares, not against the current one. The carried-pin check becomes a subset rather than an equality, so a section may carry fewer rows than the core run but never a different pin or a row the core run does not have -- and it now compares (allocator, source) pairs everywhere, which also closes the "a mapping keeps only the last sample" hole the scaling check already warned about. The RSS timeline builds its per-allocator series from the allocators the data actually carries, so a four-row memory section no longer raises KeyError. Regression coverage: the pre-#325 `latest.json` and `history.jsonl` are checked in under `ci/tests/fixtures/benchmark/legacy/`, and the new tests validate them, carry their sections onto a five-row envelope, render the result, and confirm a moved competitor pin is still rejected. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
Follows the Performance section's fifth benchmark row (#325); the two lines landed on main after that change was written. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
…quest benchmark_rejects_partial_or_extra_child_output was flaky (7/30 locally): the "extra" test child prints its malformed response and exits without reading stdin, so when it beat the harness's write_all the write failed with EPIPE and run_benchmark returned BenchError::WriteRequest instead of InvalidChildResponse. A BrokenPipe on the request write now falls through to the exit-status and response checks, which is what judges such a child. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01QbSyYDzMo4rzrdqZz7cBmt
`history-v1.schema.json` describes what the producer emits today. Rows published before the Bun row landed (#325) carry four identities and are still accepted by `ci/benchmark_report.py` via `ALLOCATOR_ID_LINEAGES`; say so in the file rather than leaving the two contracts looking contradictory. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
…forward
`benchmark-stats` has been red for eight consecutive days (since 2026-08-27;
run 33761935520, job build-and-measure) with
latest.json.memory: allocator source pins differ from the core run
and this is the cause. `render` carries the prior memory and latency sections
forward, then `validate_latest` compared every (allocator, source) pair against
the core run -- including `mimalloc-pprof`, whose commit legitimately moves
between the weekly memory/latency runs and the daily stats run. The scaling
path had already solved this by filtering to `LOCK_PINNED_ALLOCATORS`; that
filter now lives inside `validate_carried_pins`, so all three sections get it.
Only the lock-pinned competitors are comparable: they are the comparison
baseline, and one built from a different commit would silently change what the
chart means. The commit each section was measured at stays recorded on the
section itself, so the two halves of latest.json can never be read as one build.
Separately, lineage tolerance is now strictly for artifacts that were already
published. `render` requires a freshly produced core envelope to carry the
current allocator set exactly, so a producer that silently dropped a row cannot
publish -- the tolerance covers carried sections, the prior latest and history
rows, and nothing else.
Also colours the throughput bars by allocator identity rather than by position
in the summary list, matching `latency_png`, so a bar always carries its
allocator's legend colour.
Tests: a carried section survives the fork moving under it while a moved
competitor pin is still rejected, and `render` refuses a core envelope recorded
under the older set. The 2.4 MB synthetic legacy fixture is now stored gzipped
(31 KB) with a matching `.gitignore` exception.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
The comment still quoted "~6 min of sweep on top of a ~6 min fixed build" from the four-allocator sweep. Five rows add 25% of measurement and a fifth benchmark-child build, so the note now says ~7.5 + ~7.5 min against the 20-minute limit, and says plainly that a timeout should raise the limit rather than drop a thread point or a row. No behavior change. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
They share a recipe, not a tree. The `upstream-mimalloc` row is pinned at `dev3@bcee5a88`, which is MI_MALLOC_VERSION 30403 (v3.4.3), while Bun's `b20b60d9` and this fork's base `6def7be9` are both 30500 (v3.5.0). Verified against the built trees: `MI_OPT_FREE_SMALL` does not exist at `bcee5a88` and auto-enables in the two v3.5.0 trees, so the Bun and fork rows compile with `MI_OPT_FREE_SMALL=1` and the upstream row does not. So "same dev3 base", "the only intended difference is MI_PPROF" and "differ only in their source" were all misleading. They now say what is true: one recipe, three trees, of which two are the same version -- which makes Bun-vs-fork the like-for-like comparison and upstream-vs-fork a mix of base and fork changes. Bumping the upstream row to the fork's own base is tracked in #332. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S
This was referenced Sep 4, 2026
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.
Adds
oven-sh/mimalloc(Bun's fork) as a fifth allocator row in the benchmarksuite, the dashboard, the workflows and the docs. Closes the "we're a superset
and no slower than Bun" claim being an assumption from shared code rather than
a measurement.
What changed
Lock and Rust suite (
rust/)allocator-lock.jsongainsbun-mimalloc, pinned tooven-sh/mimalloc@b20b60d959093b1bc0e24306ec72ccacb3e46fb9(bun-dev3-v2tipas of 2026-09-03),
archive_sha256433e122220c0238ffa6f7acf21cdd059e31dd861197d8e4f553a56bef1dc85ac, MIT,adapter_kind: mimalloc-c-api,expected_static_library: libmimalloc.a.Ordered between
upstream-mimallocandmimalloc-pprofso the fork stays last.mi_*surface is upstream's, sonative/adapter_mimalloc.ccompiles against its headers unchanged — verifiedby compiling it and by the child's
--adapter-smoke.upstream-mimallocrecipe minusMI_PPROF,which Bun's tree does not define:
Release,MI_BUILD_STATIC=ON,MI_BUILD_SHARED=OFF,MI_BUILD_TESTS=OFF,MI_OPT_ARCH=OFF,MI_OPT_SIMD=ON,-O3 -fno-omit-frame-pointer.orchestration/validate/latency/memory/scaling, the block permutation and
near-balanced rotation, ordinal bounds, comparison-key arity, provenance
counts, the JSON schemas, and the synthetic fixtures (
scaling-raw-run.jsonregenerated via
benchmark-scaling-validate --fixture-out).Producer and dashboard (
ci/)build_benchmark_allocators.pybuilds and validates the row; the mimallocoption comparison now also asserts Bun's flags are exactly the upstream flags
minus
MI_PPROF, so the three mimalloc rows can never silently diverge.benchmark_report.py: fifth palette colour, fifth scaling series colour,fifth legend row, and every remaining arity derived from
ALLOCATOR_IDS. Barpitches were reduced so five rows fit the existing panel geometry.
The three mimalloc rows share a recipe, not a base — docs now say so
The
upstream-mimallocrow is pinned atdev3@bcee5a88, which isMI_MALLOC_VERSION 30403(v3.4.3), while Bun'sb20b60d9and this fork's base6def7be9are both30500(v3.5.0). Verified against the built trees:MI_OPT_FREE_SMALLdoes not exist atbcee5a88and auto-enables in both v3.5.0trees, so those two rows compile with
MI_OPT_FREE_SMALL=1and the upstream rowdoes not. "Same
dev3base", "the only intended difference isMI_PPROF" and"differ only in their source" were therefore misleading and are corrected:
Bun-vs-fork is the like-for-like line, upstream-vs-fork mixes base and fork
changes. Bumping the upstream row to the fork's own base is filed as #332.
Backwards compatibility (not in the issue, but it would have gone red)
The
benchmark-statsbranch still carries four-identity history rows, andlatest.json's memory/latency/scaling sections are measured on their ownschedules and carried forward onto later core envelopes. The first five-row run
would therefore have carried four-row sections into a five-row envelope and
failed.
ALLOCATOR_ID_LINEAGESnow lists the accepted allocator sets oldestfirst — the same pattern
SCALING_THREAD_POINT_LINEAGESalready uses for threadpoints — and the carried-pin check became a subset check: a section may carry
fewer rows than the core run, never a different pin. This suite's own pre-#325
synthetic envelope and history row are checked in under
ci/tests/fixtures/benchmark/legacy/(latest.json.gz, 31 KB compressed from2.4 MB — they are synthetic samples, not a copy of production data) with tests
that validate them, carry their sections onto a five-row envelope, render the
result, confirm a moved competitor pin is still rejected while a moved fork
sha is not, and confirm
renderrefuses a core envelope recorded under the olderset.
Positive control (issue acceptance criterion)
ci/tests/test_build_benchmark_allocators.py::test_a_mis_hashed_bun_archive_fails_the_build_instead_of_being_skippedbuilds a small synthetic tarball, computes its real digest, corrupts one
character of it, and asserts
download_archiveraisesArchiveError("checksum mismatch")and leaves nothing on disk — then repeatswith the honest digest to prove the control failed for the hash and not for an
unrelated reason. It exercises the same
download_archivethe Bun row goesthrough, over a local
file://URL so it needs no network; it does notre-download the real
oven-sh/mimallocarchive. Sibling tests in the same fileassert the checked-in Bun row's locked digest, pin and flags directly.
Local verification
cargo test -p benchmark-suite -p dashboardgreen, clippy reports no errors(pre-existing warnings only),
cargo fmt --checkdelta-neutral againstmain(24 diffs before and after),
ruff checkclean,pyright0 errors,pytest ci/tests312 passed, anduv run ci/verify_local.py --only rust,lint:The
lintrow is not this branch. This checkout is shared with a concurrentagent whose in-progress, untracked
ci/tests/test_bench_hole_purging_allocators.pyis collected by
pytest ci/testsand fails on fixtures it has not written yet(
FileNotFoundError: ci/tests/fixtures/allocator_idle/allocator-idle-report.json),and whose file is also the one
ruff format --checkflags. Excluding that onefile:
pytest ci/tests --ignore=ci/tests/test_bench_hole_purging_allocators.py→ 312 passed, and
ruff format --check ci→ 45 of 46 files formatted, theone exception being theirs. Nothing on this branch is red; I did not touch or
reformat their work.
The Bun row builds through the real lock pipeline
bazel 9.1.0 is not installed on this machine, so an orchestrated five-row run
was not possible locally. What I did instead: drove the four buildable rows
through
ci/build_benchmark_allocators.py's own functions — archive download →SHA-256 verify → cmake-ninja →
cargo build --bin benchmark-child→ link-identitycheck → adapter smoke. All four passed, including the new row:
The three archive digests I downloaded independently matched the lockfile
exactly, including the new one.
A short paired run — functional proof only, NOT a measurement
Driving those four children with one
--scalingrequest each, same pattern,seed, worker count and operation count:
Read this as "the row runs and pairs correctly", nothing more. The
identical workload checksum: Trueline is the point: all four children replaythe same stream and agree on the result, so the new row is a valid participant
in a paired block. The ratios are not measurements — unpinned dev box under
its own build load, no calibration, no CPU affinity, no warmup, 3 blocks, no
bootstrap. Headline numbers come from the scheduled dashboard run.
Left to the scheduled dashboard run
pipeline from a real measured run; regenerating them here would mean
publishing dev-box numbers. The next scheduled run picks up the fifth row.
numbers; there are no measured five-row numbers yet, so writing it now would
be fabrication. README instead states plainly that the charts are regenerated
by the scheduled run and a freshly added row appears there first. Worth a
follow-up once one full run has published.
This also fixes a production outage
benchmark-statshas been in for 8 daysbenchmark-statshas failed every day since 2026-08-27 (latest: run33761935520, jobbuild-and-measure) with:rendercarries the prior memory and latency sections forward, andvalidate_latestcompared every(allocator, sha)pair against the core run— including
mimalloc-pprof, whose own commit legitimately moves between theweekly memory/latency runs and the daily stats run. The scaling path had already
solved this by filtering to
LOCK_PINNED_ALLOCATORS; that filter now livesinside
validate_carried_pinsso all three sections get it. Reproduced on thefixture before and after:
Also tightened in the opposite direction:
rendernow requires a freshlyproduced core envelope to carry the current
ALLOCATOR_IDSexactly. Lineagetolerance is only for artifacts that were already published — carried sections,
the prior latest, history rows — so a producer that silently dropped a row
cannot publish.
Merge checklist
gh workflow run benchmark-stats.yml -f mode=full— all four productionbenchmark workflows share
concurrency: benchmark-stats-productionwithcancel-in-progress: false, so a manual run cannot race a cron.latest.json(this is issue benchmarks: add oven-sh/mimalloc (Bun's fork) as a fifth allocator row in every chart #325's "one fulldashboard run with five rows published" acceptance criterion, and it also
ends the 8-day outage).
benchmark-scalingSun 07:23,benchmark-memory/benchmark-latencySun 08:41, all UTC. They overlay ontothe five-row envelope from step 3.
Step 2 matters because
attach_scaling_report/attach_latency_report(Rust)require a metric report's pinned rows to exist in the base envelope's allocator
list. That guard is right and I did not loosen it: a scaling panel with a Bun
line over a core provenance table with no Bun row would be a page that cannot be
read. It just means the five-row core has to land first.
Budget check
benchmark-scaling.ymlhastimeout-minutes: 20against a comment that stillquoted "~6 min sweep on top of a ~6 min fixed build" from the four-allocator
sweep. Five rows means +25% sweep and one more
cargo build --releaseofbenchmark-child, so roughly 7.5 + 7.5 min. The comment now says that, and saysplainly that a timeout should raise the limit rather than drop a thread point or
a row. It is the tightest of the four budgets (
benchmark-statshas 50,memory/latency 60); I did not bump it speculatively.
Sentinel
benchmark-sentinel.ymlruns the fork-only PR dashboard (rust/dashboard) withno allocator matrix, so there is nothing to add to its workflow. The row
recognition the issue asks for lives in
ci/benchmark_report.py—LOCK_PINNED_ALLOCATORSnow includesbun-mimalloc, andALLOCATOR_ID_LINEAGESgoverns which allocator sets a published artifact may declare. Both updated.
Things you may want to overrule
Bun mimalloc (oven-sh @ b20b60d9).The pixel and SVG legends carry the compact row id
bun-mimalloc, matchingthe other four rows — the full label at legend scale would not fit the SVG
legend strip alongside
upstream-mimallocandmimalloc-pprof. The fulllabel and pin live in the new
docs/benchmarks.mdpinned-sources table and onthe dashboard's allocator-provenance table. Say the word and I will widen the
legend instead.
ci/bench_hole_purging.pyhas nobunrun. Feasible in principle — Bun'sfork does carry
mi_on_thread_idleandmi_purge_holes_stats_t— but thecommitted light/dark SVGs, CSV and report JSON are one measured artifact set
produced together on the reference machine, and
--checkcompares thecommitted SVGs. Adding a third series means re-measuring all of it there, not
editing the renderer, so I left it and recorded the reason in
docs/benchmarks.md.mimalloc-pprofsits at ~0.27x upstream onsparse-tiny-hot, stable acrosstwo different allocator orderings. Both are Release builds; the fork's differ
only by
MI_PPROF=1andMI_OPT_FREE_SMALL=1in its cmake defines. This isan uncalibrated dev-box reading and may be an artefact of the probe (no
warmup, no affinity) rather than anything real — but it is reproducible here,
it is nothing this PR changed, and it seemed worth surfacing rather than
deleting.
rust/dashboard/src/main.rs:4still says"four-allocator" because it quotes issue perf: publish a bounded four-allocator benchmark dashboard #171's title; and
scaling-v1.schema.json's thread-point counts were already stale against thesix-point sweep, so I scaled only the allocator dimension rather than fixing
an unrelated drift here.
Note on branch contents
9849fbad fix(bench-harness): tolerate a child that exits before reading its requestwas pushed onto this branch by another agent while I was applyingreview feedback. It is not part of #325 and I have left it alone rather than
force-push it away; my four review-fix commits sit on top of it as a
fast-forward. Reviewers should read it as a separate change that happens to
share the branch.
Closes #325
🤖 Generated with Claude Code
https://claude.ai/code/session_01YT4jVokb2gdT8ngFrH8i8S