summaryrefslogtreecommitdiff
path: root/core/Stream.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 17:31:25 -0300
committerGabriel Schneider <[email protected]>2026-11-21 19:27:50 -0300
commit71a68eac9d4bce7deb19236a9cc8338b1a37caa1 (patch)
tree9c667f806046f528cc295ef397a954ae67ced107 /core/Stream.zig
parent2b9da7be7d9520701b24d46d8db2ec56517b45b8 (diff)
downloadpardes-71a68eac9d4bce7deb19236a9cc8338b1a37caa1.tar.gz
pardes-71a68eac9d4bce7deb19236a9cc8338b1a37caa1.zip
layers: with `Changes` off a client's key pays for items A and B no more: all of jj's session state is one field, `Pardes.changes: jj.Session` (jj's answers by pane serial, the `Changes` jj runs for, the one asked meanwhile, how many were asked), whose digest is nothing until a `Changes` is asked and then one update while nothing is asked of jj, where item A had three `Stream` fields (three updates in every digest of the session, and a client's key takes several digests) beside round 4's answers list (one more); `Stream` holds nothing of jj's again (its dispatch lines stay), the session's end lets the worker and the asks go in `Session.deinit`, and the batch's 8-byte `jj` field goes (a `Changes` answer is told by its generation's bit, `jj.gen_bit`, after a paint's, and the pane it is for is the ask's, which every replica holds); measured first, a variant at a time, client-key-down against tree3's pardes-perf in the gate's own layout (ReleaseFast gui, its farms and HOME; my first script's layout read about 0.05% lower): item B as it was small +0.111%, the batch's field gone and the stream's three fields one +0.104%, the session's state one field digested as nothing until asked small +0.047%, large +0.047%, medium +0.010%
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Stream.zig')
-rw-r--r--core/Stream.zig15
1 files changed, 3 insertions, 12 deletions
diff --git a/core/Stream.zig b/core/Stream.zig
index 80812840..1d061b52 100644
--- a/core/Stream.zig
+++ b/core/Stream.zig
@@ -74,11 +74,9 @@ pub const Batch = struct {
/// A paint's answer (`paintAhead`): the colours of pane `serial`'s text
/// at `revision` from byte `start`, one syntax.Syn a byte.
painted: ?struct { serial: u32, revision: u32, start: usize } = null,
+ /// Or, with a `Changes` generation (jj.gen_bit), jj's annotate (jj's
+ /// log in `rows`, or its refusal and `end` failed).
styles: []u8 = &.{},
- /// A `Changes` answer (jj.zig) for pane `jj`, by serial: jj's log in
- /// `rows` and its annotate in `styles`, or its refusal in `rows` and
- /// `end` failed.
- jj: ?u32 = null,
pub const End = enum { done, failed };
@@ -259,14 +257,7 @@ rows_asked_at: u8 = 0,
/// Rows asked for their colours while a 9P write was served: asked again
/// on the next step (Query.produceAll).
rows_later: bool = false,
-/// The `Changes` asked of jj and its worker, the one asked while it ran,
-/// and how many were asked (jj.zig: one at a time, the last one pinned).
-changes: ?jj.Task = null,
-changes_next: ?*jj.Ask = null,
-changes_count: u32 = 0,
-
pub fn deinit(s: *Stream, gpa: std.mem.Allocator) void {
- jj.cancel(s);
s.cancelTask();
s.cancelParse();
s.cancelPaint();
@@ -700,8 +691,8 @@ const Collect = struct {
pub fn receive(p: *Pardes, b: *const Batch) void {
const s = &p.stream;
if (b.parsed) |parsed| return receiveParse(p, b, parsed.serial, parsed.revision);
- if (b.jj) |serial| return jj.receive(p, b, serial);
if (b.painted != null) return receivePaint(p, b);
+ if (b.gen & jj.gen_bit != 0) return jj.receive(p, b);
if (b.gen != s.gen or (s.state != .searching and s.state != .capped)) {
s.dropped += 1;
return;