diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 03:43:49 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 11:16:32 -0300 |
| commit | 23de206007ebae87007460afa993338781a03076 (patch) | |
| tree | 683ccf2e6e0ac34ba1f1f3eb85a96f734cdb2eae /core/panes.zig | |
| parent | b58e9b3123aaa72dff67631e7f5c0b5a55b64075 (diff) | |
| download | pardes-23de206007ebae87007460afa993338781a03076.tar.gz pardes-23de206007ebae87007460afa993338781a03076.zip | |
term: a join reloads only the terminals written since their last reload (step 3's way 1): `Term.State.written` (a feed, a reflow, a load, a revive; cleared by a reload), the session's choice taped before each terminal's hash at the `reload` site (`tape.value`), each replica reloading exactly those and comparing each hash as before; exact: one written by nothing since holds the pages its last reload's snapshot loads to on every side, and the joiner loads that snapshot again; FIRST the test (two terminals, both reloaded at a join, the shell alone written since: the next join reloads it alone on the session (1, the base 2) and on the replica, then 40,000 lines into both until each prunes its history: the replica and the joiner hold the session's snapshot bytes and digest, and a join after agrees); ReleaseFast, bytes, 2 seeds at 80 ms (load 8-18): the flooding shell alone, a join's unit on a client already there 9.9 ms p50, 13.6 ms at worst, the session's join step 1.4/14.8 ms (step 3's report: 9.6/17.7 and 1.4/14.3); with four idle shells each a full scrollback beside it (the soak patched for the measure, not landed): reloads 2,910 -> 659, the client's join unit 58.7 -> 20.3 ms p50 and 219 -> 122 ms at worst, the session's step 86.0 -> 38.2 ms p50 and 211 -> 106 at worst (the first join still reloads all); the soak, bytes, `--clients 5 --bytes --seeds 8` at 30/80/207 ms with the `cat` whole (Debug, load 25-44): 2 of 4 whole runs clean (diverged 0, unequal 0, quiet checks agreed, unlisted 0, corpus 22 of 22, no leak); in the other two, seed 2 at 80 ms (two clients at one session unit) and seed 0 at 30 ms (one client): OPEN, not root-caused (reports/pardes-term-join.md), never under a probe; seed 0 at 30 ms, 19 of 20 clean, one run hung spinning (killed, no trace); on the base seed 0 at 30 ms diverged every time and 9 of 24 runs; tui core-test 859/1011 (152 skipped), shell-test 1047/1050
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/panes.zig')
| -rw-r--r-- | core/panes.zig | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/panes.zig b/core/panes.zig index fd152e1e..7d604567 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -1120,16 +1120,20 @@ pub const Term = @import("Term.zig"); pub const positions_lost = "terminal edit position reset: out of memory"; /// At a join (Core's openView, rejoinView): under bytes, every live -/// terminal made again from its own snapshot, on every side alike, the -/// session included (Term.reload): an emulator loaded from a snapshot holds -/// its rows in other pages than one fed from its start, and ghostty prunes -/// its history a page at a time, so the joiner, loaded from the session's -/// dump made next, and the replicas there before it, would part. The +/// terminal written since its last reload made again from its own snapshot, +/// on every side alike, the session included (Term.reload): an emulator +/// loaded from a snapshot holds its rows in other pages than one fed from +/// its start, and ghostty prunes its history a page at a time, so the +/// joiner, loaded from the session's dump made next, and the replicas there +/// before it, would part. Which, the session says (`Term.State.written`, +/// taped): one written by nothing since holds the pages its last reload +/// made, on every side, and the joiner loads that snapshot again. The /// session's snapshot's hash is taped, and each replica's own compared /// with it: a check of the whole emulator at every join. pub fn reloadTerminals(p: *Pardes) void { if (tape.screenState()) return; for (p.panes) |slot| if (slot) |pane| if (pane.terminal) |state| { + if (!tape.value(.reload, written, .{state})) continue; // Its cells' size in pixels as a feed sets it (`feedOutput`): a // frontend's draw sets its own view's between steps (ansi.zig), a // window's other than a terminal's, and the snapshot holds it. @@ -1144,6 +1148,10 @@ fn sameHash(h: ?u64) ?u64 { return h; } +fn written(s: *Term.State) bool { + return s.written; +} + /// The sizes steps gave terminals (`Pane.resizeGrid`), made: between /// units, on an authority with screen-state replicas (replica.Peers.unit). pub fn resizeDeferred(p: *Pardes) void { |
