summaryrefslogtreecommitdiff
path: root/core/Jump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 16:16:51 -0300
committerGabriel Schneider <[email protected]>2026-11-23 16:17:25 -0300
commit0b612d26ed32ee765f450c643f77fe4a749a2847 (patch)
tree05e861dd4728ba2e29d107caf0631354877d2732 /core/Jump.zig
parent8dd122b13ba8def974e8728734948e32e5e89e8e (diff)
downloadpardes-0b612d26ed32ee765f450c643f77fe4a749a2847.tar.gz
pardes-0b612d26ed32ee765f450c643f77fe4a749a2847.zip
jump list: the dedupe stores an entry and then compares it where it is stored, `walk.eql(Loc, &list[w - 1], &list[w])`, where it compared `&kept`: the pointer to `kept` (56 bytes) made it a stack temporary for every entry of every step (`walk.eql` compares a place's bytes cut to their length by a call, `mem.eqlBytes`, given that pointer), about 8 instructions an entry: body-appends +12.6 k an op over tree6 (+0.0874% on longline), where `std.meta.eql` inlined kept it in registers; THE RUN THAT SETTLED IT (pardes-release-soak-2 item 1, exp1): pardes-perf of this tree with `walk.eql` (A) and with the compare put back to `std.meta.eql` (B): the jump list after every body-appends rep is the same entry for entry in both (k+2 entries after rep k, no two neighbours equal as the digest sees them: the dedupe decides nothing in that cell), B +54.0 k an op (its `std.meta.eql` not inlined: a call and two stack copies an entry) where tree6 is 0 and the installed tree -5.6 k: one source line compiled three ways; the cost was the compare's code, not a deduplication; with this, perfops against tree6: 120 of 121 within 0.1%, body-appends -0.0307% on longline and -0.021% on small, medium, large, the one over the base's own `open` cell (+8.8 k an op, another agent's: +0.167% on small) (load 2.9); Debug core-test filtered on the jump tests: the two Jump.zig tests pass
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Jump.zig')
-rw-r--r--core/Jump.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/Jump.zig b/core/Jump.zig
index d85ff75a..ccdb8fdc 100644
--- a/core/Jump.zig
+++ b/core/Jump.zig
@@ -205,11 +205,13 @@ pub fn trackJump(p: *Pardes) void {
// Two in a row the same (a closed one reopened beside its own,
// or the entry between them gone): one entry, one step; the same
// as the digest sees them (a text's `place` is bytes undefined).
- if (w > 0 and pardes.walk.eql(Loc, &v.jumps.list[w - 1], &kept)) {
+ // Compared where it is stored (w <= i: read already): a pointer
+ // to `kept` put it on the stack for every entry of every step.
+ v.jumps.list[w] = kept;
+ if (w > 0 and pardes.walk.eql(Loc, &v.jumps.list[w - 1], &v.jumps.list[w])) {
if (i == v.jumps.cur) cur = w - 1;
continue;
}
- v.jumps.list[w] = kept;
w += 1;
}
v.jumps.n = w;