191. Traces are a delta log with periodic snapshots (2026-11-22)
- Decision.
cpl_interp::trace::Recordingkeeps one small entry per step, write and print, plus a full snapshot of the variables at least every 1024 steps and only once the deltas since the last one outweigh it four times. Stepkis rebuilt from the nearest snapshot before it and the deltas after; nothing re-runs. The HTML trace, the DAP and call replay read it through the same methods (len,step,steps,line,place).crates/cpl-interp/tests/trace_log.rsmeasures the A5 budgets at 10^7 steps (ignored; run by hand in release). - Why. A snapshot per step is quadratic in memory for any array program. Measured at 10^7 steps: step back at most 34 µs, the recording 442 MB (scalar loop) and 487 MB (array loop). Recording costs about 2x over the observed run, but tracing is 13-18x the untraced run, because observation forces the tree-walker, which is about 6x slower than the VM. The 3x budget needs the VM to emit the observer events (ARCHITECTURE step 2), not a cheaper log.
- Reverse. Snapshot every step again in
Log::snapshot_if_due; tuneSNAPSHOT_EVERYand the 4x ratio to trade memory for step-back time.