diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 02:34:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 03:13:15 -0300 |
| commit | c892cf0c3246b6c41f8f67810d360c5ea0ff66ef (patch) | |
| tree | eed27b055334a7c55ce0b9c203ea4b74b371f5e8 /src/dump.zig | |
| parent | 44587446c2478de276b7c5c5a12063e6c7946b4e (diff) | |
| download | pardes-c892cf0c3246b6c41f8f67810d360c5ea0ff66ef.tar.gz pardes-c892cf0c3246b6c41f8f67810d360c5ea0ff66ef.zip | |
a replica client's join costs the session's step its mutable state alone: the dump leaves the blobs out (walk.zig `Dump.deferred`: a `.blob`'s texts of 4 KiB and up, noted where they go) and its terminals' emulators (a size: the first delta brings each), the client's writer thread writes the welcome and the dump with the blobs put back in place, and each blob is pinned until written (memory.zig `pin`: its free put off); the texts the session never digested are hashed first on a thread of their own (walk.zig `unhashed`, `makeWords`), the join waiting a boundary for them
The client is unchanged: what it reads is the dump `dumpBytes` makes, byte for byte (a test splices one and compares).
ReleaseFast, the session's worst boundary while three clients join one after another (`t2/join2.py`), before and after: typical (4.1 MB of files, 1 MB of scrollback, an 8.1 MB dump) 12.4 to 1.6 ms; big (38.6 MB, 8 MB, 76 MB) 51.3 to 1.5 ms; a 100 MB file open beside typical's (254 MB) 172.5 to 1.6 ms. Of the dump the step makes 113 to 122 KB.
PARDES_REPLICA_STATS says each join's time and the state's size.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dump.zig b/src/dump.zig index 152495e2..c64f83c4 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -174,8 +174,27 @@ pub fn dumpState(p: *Pardes) !void { /// The session as a dump, gpa-owned. pub fn dumpBytes(p: *Pardes) ![]u8 { + return dumpWith(p, null); +} + +/// A dump for a screen-state replica's join (src/replica.zig): its blobs' +/// bytes left out and noted in `deferred` (they are the session's, alive +/// while pinned: memory.zig `pin`), its terminals' emulators left out (the +/// first delta brings each afresh). What is left is the session's mutable +/// state, made in its step. +pub fn dumpJoin(p: *Pardes, deferred: *std.ArrayListUnmanaged(walk.Deferred)) ![]u8 { + slim_terminals = true; + defer slim_terminals = false; + return dumpWith(p, deferred); +} + +/// `dumpJoin`'s: a terminal dumps its size, not its emulator. +pub var slim_terminals = false; + +fn dumpWith(p: *Pardes, deferred: ?*std.ArrayListUnmanaged(walk.Deferred)) ![]u8 { var d = try Session.init(p.gpa); errdefer d.deinit(); + d.deferred = deferred; try d.put(Pardes, p); const mounts: []const filesystem.Mount = p.fs.mounts.items; try d.put([]const filesystem.Mount, &mounts); |
