Farid Zakaria presents Rewind’s new `rewind time` command, which analyzes recorded program runs to show their critical path: the longest chain of dependent work that determines the fastest possible completion, regardless of available CPU cores. Inspired by Brendan Gregg’s performance-analysis methods, it accounts for both computation and time spent blocked or asleep - work that ordinary CPU profiles can miss. Rewind can do this because its deterministic virtual machine already records context switches and now captures wakeups as well, enabling detailed analysis after a run without having to predict and trace the problem in advance.
A libuv build and test run illustrates the approach: it takes 78 seconds on one virtual CPU, while its 47.4-second critical path means extra cores can save only the difference. Two-thirds of that path is sleep, and the test phase accounts for 42 seconds; its runner executes 287 tests sequentially, many waiting on timers. The tool identifies which processes and tasks lie on the path, estimates how much faster the run could finish if each were eliminated (“drag”), and lets users inspect source lines, stacks, and individual moments in the recording. In one example, a test’s 3.38 seconds of sleep comes from 75 intentional 45-millisecond delays, revealing that the apparent bottleneck is not something to optimize. Results can also be explored in Rewind’s interface, GDB, flame graphs, or Perfetto.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.