Commit 926097c
add --repeat, to profile a 100ms computation without process noise
`calculate-all` runs in ~100ms, which is a thin window to sample: at 9999 Hz over
16 threads one run yields ~14k samples. Repeating the *process* to get more charges
every iteration for startup, first-touch faulting ~40 MB, and mimalloc's teardown
purge - and those are not free, they are ~2-3% of a run and all of it noise relative
to the loops one is trying to measure. `process exit` alone was 0.86% of the last
profile, essentially all of it the purge.
Repeating in-process keeps the allocator and page tables warm instead. Measured
steady state is ~2-3% under separate processes of the same binary, 93-99 vs
98-105 ms, which is that overhead going away.
Warm-up is two iterations, not one - worth stating because "discard the first" is
the natural assumption and it is wrong here. Across repeated 10-12 iteration runs
the opening pair came in at 111/134 and 101/120 ms against a 93-99 steady state,
so the second is reliably the slowest, not the first. The per-iteration internal
timings are logged at `RUST_LOG=info` so they can be checked rather than assumed.
`black_box` on each iteration's result so nothing about the repetition lets the
optimizer decide later iterations are redundant.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8593f38 commit 926097c
1 file changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
18 | 36 | | |
19 | 37 | | |
20 | 38 | | |
| |||
93 | 111 | | |
94 | 112 | | |
95 | 113 | | |
96 | | - | |
97 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
98 | 123 | | |
99 | 124 | | |
100 | 125 | | |
| |||
0 commit comments