Skip to content

perf(runner-shared): read the memtrack event stream through a 1 MiB buffer - #616

Draft
not-matthias wants to merge 1 commit into
mainfrom
cod-4142-memtrack-decode-buffer
Draft

not-matthias wants to merge 1 commit into
mainfrom
cod-4142-memtrack-decode-buffer

Conversation

@not-matthias

@not-matthias not-matthias commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Read the decompressed memtrack event stream through a 1 MiB BufReader instead of the default 8 KiB one.

Stack records carry an 8 KiB byte field that rmp_serde reads with Read::take(..).read_to_end, about the size of the default buffer. A buffer well above that field size is cheap and measurably faster.

Measured on one 2.3 GiB artifact whose events are mostly stack records: the full memory callgraph parse went from 51.4 s / 53.3 s to 49.3 s / 48.3 s (two runs each, same machine), output byte-identical.

Refs COD-4142

…uffer

Stack records carry an 8 KiB byte field, which `rmp_serde` reads with
`Read::take(..).read_to_end`. With the default 8 KiB `BufReader` almost
every such read crosses a buffer refill. A 1 MiB buffer keeps those reads
inside the buffer; on a 2.3 GiB artifact with 14.6M stack records this
took the memory callgraph parse from about 52 s to 48 s.

Refs COD-4142
@codspeed

codspeed Bot commented Nov 5, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 47.08%

3 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 8 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 2 regressed benchmarks
✅ 21 untouched benchmarks
⏩ 24 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory find_module_events[1000000] 4.4 MB 8.4 MB -47.32%
❌ Memory find_module_events_with_stacks[1000000] 4.5 MB 8.5 MB -46.84%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing cod-4142-memtrack-decode-buffer (f534664) with main (8b62e4a)

Open in CodSpeed

Footnotes

  1. 24 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