Farid Zakaria uses Rewind, a virtual machine that can replay a recorded run, to find what holds up a libuv build. He follows the critical path: the longest chain of steps that have to wait for one another. A CPU profile can miss much of that chain because blocked threads aren’t using the CPU.
- On one virtual CPU, the run took 78 seconds. Rewind identified a 47.4-second critical path, 67% of it spent waiting. The test phase accounted for about 42 seconds of that path.
- Rewind records when threads trade places and who wakes whom. Zakaria can go back to a wait after the run and see the source line responsible.
- One timing test spent about 3.38 seconds across 75 sleeps. Replay showed that it sleeps deliberately to measure how the clock advances during a wait.
The trace tells you where to look before adding cores or changing code. The 47.4 seconds is a lower bound from this recording; the article doesn’t demonstrate a multicore speedup or a faster version of libuv.
The Hacker News thread compares replay tools and asks what a single-CPU recording leaves out.
What the thread adds
- roca — “rr records and replays user-space processes and has to understand the user/kernel interface really well” … “RewindVM replays the whole VM”.
- aidanhs asks what one virtual CPU means for “very high throughput multithreaded pipelines.” In a follow-up, Zakaria clarifies that one virtual CPU removes races that depend on hardware timing across cores. Rewind can still fork a run under a different schedule to test other thread orderings.
- perdy — “we moved the CI benchmarks to Callgrind: instruction counts instead of time, with the cache geometry pinned so it doesn’t matter which runner you land on.” The trade-off: “you lose everything off-CPU”.
uvdn7 asks how to connect async work back to the request it serves. setheron says the scheduling order is repeatable. That reply leaves open how the tool identifies which work belongs to the same request.
From a 45-comment thread, in HN’s own order.