From c0f5bd34d0f5339626d2c28c4012db7be46b55f3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:30:52 -0300 Subject: recorder: a keyframe every 4096 moments, measured on Lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lua 5.4 through ztrace cc with everything instrumented, on a ten-line script: 3.2 million moments, and at a keyframe every 256 the keyframes were half of its 304 MB. At 4096 it is 156 MB and records in 1.7 s instead of 3.9; a seek to any moment is a millisecond on average, three at worst, and reading in order 6 µs a moment. The README has the table. --- src/trace/store.zig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/trace/store.zig') diff --git a/src/trace/store.zig b/src/trace/store.zig index 8d01570..c8c32e7 100644 --- a/src/trace/store.zig +++ b/src/trace/store.zig @@ -3,7 +3,7 @@ //! //! root = map { //! moments list of bytes: a moment's events, encoded (`Codec`) -//! keys list of keyframe, one a batch of moments +//! keys list of keyframe, one a batch of moments (4096) //! } //! keyframe = map { //! moment the last moment it holds @@ -339,9 +339,11 @@ pub const Recorder = struct { cut: u64 = Kind.step.bit() | Kind.breakpoint.bit() | Kind.syscall_exit.bit() | Kind.signal.bit() | Kind.exit.bit() | Kind.line.bit() | Kind.mark.bit(), /// ... or when its events pass this many bytes. max_delta: usize = 1 << 20, - /// Moments a keyframe, at most: what a reader replays to reach one. A - /// crash loses the batch being gathered. - batch: usize = 256, + /// Moments a keyframe, at most: what a reader replays to reach one (a + /// millisecond, measured), and what a crash loses. Fewer would be seeked + /// to faster and cost more: at 256 the keyframes were half of a + /// recording of Lua. + batch: usize = 4096, /// The file may grow this large; past it `emit` is `error.RecordingFull`. /// A recording is meant to be megabytes: reaching this means too much is /// being recorded (every instruction of a long run, whole buffers). -- cgit v1.3