summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 12:30:52 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:37:33 -0300
commitc0f5bd34d0f5339626d2c28c4012db7be46b55f3 (patch)
tree391ae454deae06617dd388cafc6ae525a5b3007b /src
parent8ac0639bfc0186acedb11759432a2cfa277193f2 (diff)
downloadcomputeranim-c0f5bd34d0f5339626d2c28c4012db7be46b55f3.tar.gz
computeranim-c0f5bd34d0f5339626d2c28c4012db7be46b55f3.zip
recorder: a keyframe every 4096 moments, measured on Lua
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.
Diffstat (limited to 'src')
-rw-r--r--src/trace/store.zig10
1 files changed, 6 insertions, 4 deletions
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).