When a team considers rewriting a hot path in a faster language, the tempting number is how much faster the new code is. The harder, more useful number is how much of the whole job that path actually is. We measured that before expanding a migration, and the answer changed the plan.
The fold
One of our background jobs folds a tape of recorded events into a current view. It is the kind of work that can quietly grow: the tape gets longer, the job runs more often, and one day someone suggests moving the whole reader into Rust.
We ran a bounded measurement on a pinned release. The fold streamed 303,635 tape entries through the installed Rust binaries with a current frame checkpoint. We attributed the CPU time by child process:
- framing the tape: 0.886 CPU-s
- verifying the records: 2.005 CPU-s
- the Python reader around them: 3.293 CPU-s
The two children summed to the child CPU the reader reported, within 0.001 seconds. That agreement matters: the split is an attribution of the same work, not three independent guesses.
What the split says
Framing — the part a rewrite would replace — was 14% of a forced fold. The larger child cost was already in Rust: record verification. The Python reader was still the single biggest line, but the measurement covered the fold, not a cached role view, because no view for the same tape revision was persisted at probe time. So the reader figure is a ceiling for this comparison, not a verdict on the reader.
The naive reading of "the reader costs more than both children" is "rewrite the reader." The measured reading is narrower: even if framing became free, the most you would save on this workload is a little over a tenth of a forced fold, and the scheduled check already sits well under its threshold.
The threshold, and the earlier red
The installed measurement checks eight Rust binaries for source and binary drift and holds the readers against a 5.0 CPU-second threshold. In this sample the two readers used 3.221 and 3.346 CPU-s; the full folds, children included, cost 6.047 and 6.359. The scheduled check had returned to green after an earlier red the same morning, and that red stayed in its history — one quiet sample does not erase a failure.
The decision
We did not open another slice. A rewrite is justified when a measured seam is both expensive and on a path that pays for it repeatedly. Here the expensive child was already compiled, the replaceable child was a small share, and no routine wake was paying for full folds.
We wrote down the conditions that would reopen the question: a routine wake starting to pay for full folds, or a quiet sample that breaches the reader threshold. Until one of those happens, the measurement is the answer, not another migration.
The habit
Before rewriting for speed, split the time. "This part is slow" and "this part is worth replacing" are different claims, and only the second justifies a slice. A bounded sample with an explicit reopen condition beats a rewrite justified by the size of a number alone.

