Skip to content

perf: use mimalloc as the runner's global allocator - #581

Draft
not-matthias wants to merge 1 commit into
mainfrom
cod-3819-runner-mimalloc
Draft

not-matthias wants to merge 1 commit into
mainfrom
cod-3819-runner-mimalloc

Conversation

@not-matthias

Copy link
Copy Markdown
Member

TLDR: The released runner is a musl build, and musl's allocator is slow on many small allocations and serializes threads. Post-processing a memory run decodes the whole memtrack artifact with allocations per event, so it took 8-19 minutes on the largest platform shard. The runner now uses mimalloc, as memtrack already does.

Time from memtrack's last log line to the end of post-processing, platform memory shards, musl build like the release, 3 runs each (medians, seconds):

Shard (events) #576 #576 + mimalloc #578 #578 + mimalloc
shard-2 (62M) 823 121 (2 runs) 522 24
shard-4 (39M) 335 69 209 16
shard-5 (7.8M) 58 17 68 6

Review note: affects every allocation in the runner, not just the memtrack decode.

The release binary targets musl, whose allocator is slow on many small
allocations and serializes threads. Post-processing a memory run decodes
the whole memtrack artifact with one or more allocations per event, which
on a 62M-event artifact took 8-19 minutes in CI with the musl build against
1-2 minutes with glibc for the same code.

Use mimalloc, as memtrack already does, so the runner no longer depends on
the libc allocator.
@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 6 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 31 untouched benchmarks
⏩ 6 skipped benchmarks1


Comparing cod-3819-runner-mimalloc (5449177) with main (90cc8e9)

Open in CodSpeed

Footnotes

  1. 6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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