Skip to content

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

Merged
not-matthias merged 2 commits into
mainfrom
cod-3819-runner-mimalloc
Oct 13, 2026
Merged

not-matthias merged 2 commits 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.

@codspeed

codspeed Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 32.52%

⚠️ 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.

⚠️ 8 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

⚡ 2 improved benchmarks
✅ 39 untouched benchmarks
⏩ 6 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ WallTime encode_events_realistic[16] 130.5 ms 92.5 ms +41.1%
⚡ WallTime encode_events_realistic[8] 128.6 ms 103.3 ms +24.46%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing cod-3819-runner-mimalloc (5ee7e58) with main (5ff86d7)

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. ↩

@GuillaumeLagrange

Copy link
Copy Markdown
Contributor

@not-matthias this is already done as part of #531

@not-matthias
not-matthias force-pushed the cod-3819-runner-mimalloc branch from 5449177 to 3167179 Compare October 12, 2026 15:24
@not-matthias
not-matthias changed the base branch from main to cod-3819-parallel-module-event-scan October 12, 2026 15:26
@not-matthias
not-matthias marked this pull request as ready for review October 12, 2026 15:26
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable failure was found.

Summary

The PR switches the codspeed binary to mimalloc and shares its dependency declaration across the workspace.

  • The runner uses mimalloc for its memory allocations.

The previous review commit is not an ancestor of this head, so the full PR diff was reviewed. No previous finding threads were supplied.

Reviews (3) · Last reviewed commit: "test(runner-shared): run the memtrack be..." · Reviewed by Greptile

@not-matthias
not-matthias added this pull request to stack #579 October 12, 2026 16:22
Base automatically changed from cod-3819-parallel-module-event-scan to main October 12, 2026 16:40

@GuillaumeLagrange GuillaumeLagrange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

olgtm

Comment thread Cargo.toml Outdated
Comment thread src/main.rs Outdated
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.
@not-matthias
not-matthias force-pushed the cod-3819-runner-mimalloc branch from f907a35 to 5ee7e58 Compare October 13, 2026 14:17
@not-matthias
not-matthias merged commit 5ee7e58 into main Oct 13, 2026
62 checks passed
@not-matthias
not-matthias deleted the cod-3819-runner-mimalloc branch October 13, 2026 14:48
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.

2 participants