diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-23 15:42:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-23 16:31:13 -0300 |
| commit | 6f9a8b907a504c28aef6c68b923508419b54f0ee (patch) | |
| tree | 4a9411cf4caffb6b7886f52dd67392a623915338 /core/look.zig | |
| parent | fa3550eedec44e624384b478fc19a40d94fb7a82 (diff) | |
| download | pardes-6f9a8b907a504c28aef6c68b923508419b54f0ee.tar.gz pardes-6f9a8b907a504c28aef6c68b923508419b54f0ee.zip | |
changes layer: a file with no layer pays for it what tree6 paid, found by measure (instructions by symbol and by source line, Intel PT, on the ReleaseFast pardes-perf, tree6 against round 9's base): perfops against tree6 from 12 of 121 over 0.1% to 1 (the base's `body-appends` +0.44%, `open` +0.235%, `client-key-down` +0.13..0.16%, `client-delete-undo`, `client-edit-char`, `deep-sel` +0.10..0.14%, every frame +3.8k); (1) `File.fillBody`'s row walk compiled worse with the gutter number's layer lookups (`readOnlyRow`, `fileRow`) inlined beside it: PT by source line, tree6's lines matched to the base's by their text, the same bytes walked, the inlined `fitEnd` byte loop +98k an op with no line and its checks reshuffled (body-appends +86k an op): `fillBody(comptime layered)`, as tree6's `comptime ghosted` was, chosen by `mapRows` and `bodyText` (a length test); (2) the 9P path asked the file's text and its offsets through calls: `bodyOf`, `fileDot`, `setFileDot`, `showFileOffset` answer with no layer by a length test, inline (core/ninep/pane.zig); (3) `open` (+8.8k since tree6, step 1's): not the change-id rule's regexp (it stands after the file rules and is never reached for a file) but its PARSE: pardes-perf's open boots a core each time and each core reads the rules at its first plumb (`Plumb.Parser.take` +4.0k, `expand` +1.4k, `feed` +1.2k, `endSet`, `word`, `append`, `stringToEnum`: +8.6k): the rule is deleted from core/plumbing and Look's own unresolved path takes a change id (core/look.zig `lookUnresolved`: eight letters or more, k to z, in a pane neither a raw terminal's nor a kind's, the rule's `src is pardes`; `jj.diffChange`; one naming no change searched for as before), no rule and no parse anywhere; (4) a client's key (+2.0..2.4k): the digest of File.State's two new fields, two small hash updates a pane a digest (Wyhash's buffered update and its memcpy): one field, `layer: Layer` (`owner`, `lines`: what were `layer` and `read_only`), digested by hand (`Layer.digest`: nothing hashed with no layer shown, a length test), its line in replica.zig's `hand_walked` (the test joining a client over a pane showing the layer); LEFT FOR THE COORDINATOR'S RULING: `terminal on all` +0.141% (+147k an op over the 18 terminal cells, +7.8k a terminal frame, the same in-run by an in-process counter around each cell): PT by line in the terminal's render cell: core/ansi.zig `recolor`'s per-cell style loop (source unchanged) compiled worse inlined into `body_layer.renderBody` after round 8's deletions there (`w.ghost`'s skips, `Pane.wrapAt`'s `ghost` field): what it buys is those deletions; `@call(.never_inline, ansi.recolor)` made it worse (+0.227%, and `deep-sel` +0.285%), not kept; perfops (the gate's malloc setting, load 2-9): v4 against tree6 120 of 121 within 0.1%, largest under the budget `client-key-down` on medium +0.065%; core-test 952/1118 (166 skipped) Debug tui
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/look.zig')
| -rw-r--r-- | core/look.zig | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/look.zig b/core/look.zig index 2e3d9e57..b240b6e2 100644 --- a/core/look.zig +++ b/core/look.zig @@ -738,7 +738,7 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at_in: Spot, landing: enum { center, if (at_in.line == 0) return; // A place's line is the file's: past the `Changes` layer's lines. var at = at_in; - if (pane.file) |*f| if (f.read_only.len > 0) { + if (pane.file) |*f| if (f.layer.lines.len > 0) { at.line = @intCast(panes.File.bufferRow(f, at.line - 1) + 1); if (at.end_line != 0) at.end_line = @intCast(panes.File.bufferRow(f, at.end_line - 1) + 1); }; @@ -1048,6 +1048,12 @@ fn lookUnresolved(p: *Pardes, id: usize, pane: *Pane, trimmed: []const u8, text: // 9P is no keyboard input, and searches whatever the key mode. if (pane.addon != null or (pane.body.mode == .tty and !p.fs.serving)) return; if (text.len == 0) return; + // A jj change id (eight of its letters or more, k to z, as jj log + // shows them) in a jj repository: its patch (jj.diffChange); one that + // names no change is searched for. Look's own, not a plumbing rule: the + // rules are read at a session's first look, a file's open among them, + // and that rule cost every open (perf: open +8.8k instructions). + if (trimmed.len >= 8 and @import("jj.zig").isChangeId(trimmed) and @import("jj.zig").diffChange(p, id, trimmed, false)) return; if (pane.file != null) return lookWord(p, id, pane, text); p.word_look = true; defer p.word_look = false; @@ -1400,7 +1406,7 @@ fn settleLine(p: *Pardes, id: usize, path: []const u8, at: Spot, before: usize, const shown = p.panes[p.view().active] orelse return; const f = if (shown.file) |*file| file else return; // N is the file's line N (the `Changes` layer's lines have no number). - if (at.line > panes.File.nlines(p.gpa, f) - f.read_only.len) { + if (at.line > panes.File.nlines(p.gpa, f) - f.layer.lines.len) { if (opened) |free| p.removePane(free, null) catch |err| p.reportError(.at(id), "look", err); if (p.panes[before] != null) p.view().active = before; return missedLine(p, id, path, at.line); |
