diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 04:51:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 06:44:43 -0300 |
| commit | 89f4b611e4e6e1732595d070184daf167b53bfb3 (patch) | |
| tree | 3a37b8eca99c41efbc32ded89483172ee79a013c /core/Places.zig | |
| parent | 5b7124d10f9b2db8d1c5e99eacb9b6d2fffff0cc (diff) | |
| download | pardes-89f4b611e4e6e1732595d070184daf167b53bfb3.tar.gz pardes-89f4b611e4e6e1732595d070184daf167b53bfb3.zip | |
tape: the budget is a count, step 7 (reports/pardes-handle-69-design.md section 2, P33's lean 3): Names.rescore stops after 3,000,000 of the scorer's cells (a key's bytes times the query's and one, what `match` can visit of a candidate, so a long query's slice is no longer than a short one's) and a tick's Places.fill after 512 KiB read, the places an insert above the view moves charged as read (with many places below it, the moving was what only the clock bounded), so no clock is read in a step: Tape.over, the free over, overNow, the budget site and the two clock reads are deleted, and a far client's guess of a key into a big name query is the session's step by construction (test/daemon.py --far's new scene, a Find over 40,000 names typed into: mispredicted 1, 1, 1 and 4 in four runs of the base, 0 in four of this); the constants measured by pardes-perf's new --search (ReleaseFast, this machine at a load of 12 to 24, every call's instructions counted): a tick's fill on the 18 MB text at most 23-24M instructions where the clock's 4 ms ticks took 47-75M, a rescore's scan on a long query at most 31.5M where the clock's took 32.6M; the longest rescore is not the scan but its sort of every hit at each call (about 125-145M instructions, 16-22 ms, with the clock and with the count alike: not bounded by either, left); the semantics word moves (the site's number goes: 7a610621b2f37456 -> df1f0502317ed362), so cross_replay across this change diverges at the first site after it, as it must; tui core-test 857/1008 (151 skipped), shell-test 1048/1051, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay 275/275, process-test 0 of 144 failed, both soaks diverged 0 unequal 0 corpus 22 of 22 no leak (bytes: the base's one unlisted `now` stop at 30 ms), daemon.py plain, --far, --games (alone, at load 24), --window-clients, --upgrade both ways against merge31 (new->old alone after the Adopt race); gui unit-test 1645/1649 (the perf check's BaselineHarnessMismatch); frames 77/77, perfab +0.055%, the 121 counts within 0.1% against tree2 (key-down on medium 10,039,595, render on medium 11,454,507; the base 10,039,283 and 11,454,252)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Places.zig')
| -rw-r--r-- | core/Places.zig | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/core/Places.zig b/core/Places.zig index 9ffbff88..35b79805 100644 --- a/core/Places.zig +++ b/core/Places.zig @@ -46,13 +46,14 @@ pub const Provenance = enum { typed, search, list }; /// Places past this many are not kept. ponytail: 16 bytes a place, 16 MB /// at the cap; a sparse count past it if a million is ever too few. pub const max_hits = 1 << 20; -/// What one frame spends finding places: about 4 ms on the clock, checked -/// between pieces of the text; mvzr's steps (Regex.budget is about 300 ms -/// of them, so this is about 5 ms), which bound one slow piece; and bytes -/// read, the bound where there is no clock. -pub const frame_ns: u64 = 4 * std.time.ns_per_ms; +/// What one frame spends finding places: bytes of the text read (and the +/// places an insert above the view moves, as many bytes), about 4 ms in a +/// release build (`pardes-perf --search`); and mvzr's steps (Regex.budget +/// is about 300 ms of them, so this is about 5 ms), which bound one slow +/// piece. Counts, not the clock: a replica finds as many places a frame as +/// its session (P27, P30). pub const frame_steps: u64 = regexp.Regex.budget / 64; -pub const frame_bytes: usize = 8 << 20; +pub const frame_bytes: usize = 512 << 10; /// The text is searched in pieces of about this much, each ending at a /// line's end, so that a budget runs out between pieces, not inside one. /// A folding set lowers its copy of the text a piece at a time too. @@ -405,7 +406,6 @@ fn restart(set: *Places, p: *Pardes, f: *File.State) void { /// been searched, make it current. Run after every step (with no budget: /// the view only) and every tick (a frame's). pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) void { - const started_ns = pardes.FrameStats.nowNs(); if (!set.started) return; set.derive(p.gpa); const f = if (pane.file) |*file| file else return set.clear(p.gpa); @@ -490,17 +490,14 @@ pub fn fill(set: *Places, p: *Pardes, pane: *Pane, bytes: usize, steps: u64) voi } if (forward) set.hi = at else { set.hits.insertSlice(gpa, set.nhead, head.items) catch return; + // With many places below, moving them is most of the work. + left -|= (set.hits.items.len - set.nhead - head.items.len) * @sizeOf(Hit); if (set.current) |*c| c.* += head.items.len; set.nhead += head.items.len; set.head_to = at; } left -|= at - from; if (short) break; - // A frame's time spent (a whole search's for n and N, whose steps - // are mvzr's whole budget). - // The clock's verdict is the session's (core/tape.zig): a replica - // finds as many places a frame as this did. - if (started_ns != 0 and bytes != std.math.maxInt(usize) and pardes.tape.over(started_ns, frame_ns)) break; } if (set.hits.items.len != found_before) { set.gen +%= 1; |
