summaryrefslogtreecommitdiff
path: root/core/Places.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Places.zig')
-rw-r--r--core/Places.zig21
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;