diff --git a/TODO.md b/TODO.md index 433899c..e1800b8 100644 --- a/TODO.md +++ b/TODO.md @@ -1201,8 +1201,47 @@ references-nav,index-scope}/README.md, docs/perf/README.md) the new default. Cost measured rung by rung: 1 / 1 / 21 / 252 files at depths 0 / 1 / 2 / 3. +### Take 2 follow-up (2026-08-29) — the first RTL open at the default scope + +Measured in `performance_take2.md` §5b: opening `hw/ip/aes/rtl/aes.sv` +at `scopeDepth: 2` raises the scope to `hw/ip` and costs 1.4–1.7 s. +Files: `crates/lucisv_server/src/{candidates.rs,state.rs,server.rs,perf.rs}`, +`docs/features/index-scope/README.md`, `docs/perf/README.md`. + +- [x] Diagnosis corrected against the running binary: the widen already + takes the cheap path for a subsuming scope and already diffs by + **file against the index** (the bar reads 1 685, not 1 807, when + the old block's 124 files are inside the new root), so nothing was + re-indexed. The chooser's `Whole` arm is still unreachable. Pinned + by `state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds` + and a `widen_of` table row. +- [x] The real cost found and fixed: folding a widen's words into the + completion table inserted each new word into a sorted `Vec` on its + own, which is quadratic in the batch — **403 ms of the 935 ms** on + opentitan's `hw/ip`. Counted per batch and merged once: 43 ms. + Warm **935 / 881 → 555 / 564 ms**, cold **1 529 → 1 175 ms**. +- [ ] **Still slow, filed:** what is left of that jump is real work over + 1 683 genuinely new files — 325 ms re-lexing them for the + completion word table (the persistent store holds a file's facts + but not its words), ~100 ms walking and reading them, ~80 ms + hashing and decoding records. Storing the word list beside the + facts is the next lever and is `index-persistence`'s call: it is a + `FACTS_FORMAT` change. +- [ ] **Not done, deliberately:** a widen still does not interleave, so + this is a bar the user watches once per session per big widen. The + coalescing rule is unchanged. + ### Deferred, filed +- [ ] `codeAction` costs 185–201 ms at a 128-file fan-out and offers + **zero** actions there (`performance_take2.md` §6a): ~1.4 ms per + instantiating file plus a ~13 ms floor, paid before anything knows + there is nothing to offer. Wants either the lazy resolve below or + a cheap zero-detector that answers before the fan-out is walked. +- [ ] `inlayHint` returns **0 hints at the default scope** where the + workspace scope returns 4 (`performance_take2.md` §8): investigate + before assuming it is scope-relative-answers working as intended — + the hinted instantiation's module may be in scope and still unhinted. - [ ] codeAction lazy resolution (`codeAction/resolve`): make the offer index-only (~0 ms regardless of fan-out), edits computed on lightbulb click — kills the 83 ms worst case. Owner-approved diff --git a/crates/lucisv_server/src/candidates.rs b/crates/lucisv_server/src/candidates.rs index 2faf5d1..4cc0155 100644 --- a/crates/lucisv_server/src/candidates.rs +++ b/crates/lucisv_server/src/candidates.rs @@ -140,10 +140,19 @@ impl Candidates { /// than one per file: they are read off the index and nothing else, so /// doing it once at the end of the batch is doing it once with the same /// answer. The word table is patched per file exactly as it is there. + /// **One re-sort of the word table for the whole batch, too**, which is + /// what makes a scope widen over a big folder affordable: the table is a + /// sorted `Vec`, and inserting each of a widen's tens of thousands of new + /// words into it one at a time moves the tail of the table once per word. + /// Counted per batch and merged once, the same batch is one pass + /// (`docs/features/index-scope/README.md`, 2026-08-29 — 403 ms → 43 ms for + /// the 1 807 files of opentitan's `hw/ip`). pub fn absorb(&mut self, index: &WorkspaceIndex, batch: Vec<(PathBuf, Vec)>) { + let mut touched: HashMap = HashMap::new(); for (path, words) in batch { - self.set_words(&path, words); + self.count_words(&path, words, &mut touched); } + self.merge_words(touched); (self.units, self.modules) = index_tables(index); self.macros = macros_of(index); } @@ -157,22 +166,38 @@ impl Candidates { /// Make `words` this file's words, adjusting the workspace-wide table. fn set_words(&mut self, path: &Path, words: Vec) { + let mut touched = HashMap::new(); + self.count_words(path, words, &mut touched); + self.merge_words(touched); + } + + /// Make `words` this file's words in the per-file tables and the counts, + /// leaving the sorted table to [`Candidates::merge_words`]. + /// + /// `touched` collects every word whose count this call moved, against + /// **whether the workspace held it before the batch began** — recorded at + /// the first touch, so a word a batch takes and gives back is correctly + /// seen as never having moved. + fn count_words( + &mut self, + path: &Path, + words: Vec, + touched: &mut HashMap, + ) { for word in self.per_file.remove(path).unwrap_or_default() { let Some(count) = self.word_files.get_mut(&word) else { continue }; *count -= 1; if *count == 0 { self.word_files.remove(&word); - if let Ok(at) = self.words.binary_search_by(|held| word_cmp(held, &word)) { - self.words.remove(at); - } + touched.entry(word).or_insert(true); } } for word in &words { + let held = self.word_files.contains_key(word); let count = self.word_files.entry(word.clone()).or_default(); *count += 1; - if *count == 1 { - let at = self.words.partition_point(|held| word_cmp(held, word) == Ordering::Less); - self.words.insert(at, word.clone()); + if !held { + touched.entry(word.clone()).or_insert(false); } } if !words.is_empty() { @@ -180,6 +205,46 @@ impl Candidates { } } + /// Bring the sorted word table back in step with the counts, in one pass. + /// + /// A word in `touched` that the counts still hold and the table does not is + /// an insertion; one the counts have dropped and the table still holds is a + /// removal; a word that ends where it started is neither. What comes out is + /// the table [`Candidates::build`] would have sorted from the same counts, + /// because [`word_cmp`] is a total order on distinct words — so merging a + /// sorted run into a sorted table is that sort's own answer. + fn merge_words(&mut self, touched: HashMap) { + let mut added: Vec = Vec::new(); + let mut dropped: HashSet = HashSet::new(); + for (word, was_held) in touched { + match (was_held, self.word_files.contains_key(&word)) { + (false, true) => added.push(word), + (true, false) => { + dropped.insert(word); + } + _ => {} + } + } + if added.is_empty() && dropped.is_empty() { + return; + } + sort_by_name(&mut added, |word| word.as_str()); + let held = std::mem::take(&mut self.words); + let mut out = Vec::with_capacity(held.len() + added.len()); + let mut added = added.into_iter().peekable(); + for word in held { + if dropped.contains(&word) { + continue; + } + while let Some(new) = added.next_if(|new| word_cmp(new, &word) == Ordering::Less) { + out.push(new); + } + out.push(word); + } + out.extend(added); + self.words = out; + } + /// Index names starting with `prefix`, case-insensitively. pub fn units(&self, prefix: &str) -> &[Candidate] { matching(&self.units, prefix, |c| &c.name) @@ -573,4 +638,81 @@ mod tests { candidates.remove_file(¤t, Path::new("/rtl/a.sv")); assert!(candidates.words("w2").is_empty(), "removing an already-removed file is a no-op"); } + + #[test] + fn a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted() { + // The scope widen's own path, and since 2026-08-29 the batch pays one + // merge instead of one insert per word. The claim that buys is exact: + // what comes out is the table `build` sorts from the same counts. The + // hostile cases are all in this one batch — a word only one of the + // batch's files still holds, a word the batch takes from one file and + // gives back through another, a word nothing holds afterwards, and + // case variants, which `word_cmp` orders case-insensitively first and + // exactly second. + let held = [ + ( + "/rtl/a.sv", + "module a;\n logic Shared;\n logic only_a;\n logic gone;\nendmodule\n", + ), + ("/rtl/b.sv", "module b;\n logic shared;\n logic Only_B;\nendmodule\n"), + ]; + let after = [ + // `a.sv` rewritten: `gone` leaves the workspace, `only_a` leaves + // this file but arrives in `c.sv` in the same batch. + ("/rtl/a.sv", "module a;\n logic Shared;\n logic zeta;\n logic Alpha;\nendmodule\n"), + ("/rtl/b.sv", "module b;\n logic shared;\n logic Only_B;\nendmodule\n"), + ( + "/rtl/c.sv", + "module c;\n logic shared;\n logic alpha;\n logic only_a;\nendmodule\n", + ), + ("/rtl/d.sv", "module d;\n logic ALPHA;\n logic mid;\nendmodule\n"), + ]; + + let held_srcs = sources(&held); + let held_index = + WorkspaceIndex::build(held_srcs.iter().map(|(p, t)| (p.clone(), t.as_str()))); + let mut widened = Candidates::build(&held_index, &held_srcs, HashMap::new()); + + let srcs = sources(&after); + let index = WorkspaceIndex::build(srcs.iter().map(|(p, t)| (p.clone(), t.as_str()))); + let batch: Vec<(PathBuf, Vec)> = after + .iter() + .filter(|(path, _)| *path != "/rtl/b.sv") + .map(|(path, text)| (PathBuf::from(*path), words_in(text))) + .collect(); + widened.absorb(&index, batch); + + let rebuilt = Candidates::build(&index, &srcs, HashMap::new()); + assert_eq!(widened.words(""), rebuilt.words(""), "the whole table, in order"); + for prefix in ["", "a", "al", "ALPHA", "shared", "only", "only_a", "gone", "z", "zzz"] { + assert_eq!(widened.words(prefix), rebuilt.words(prefix), "prefix {prefix:?}"); + } + assert_eq!(widened.words("gone").len(), 0, "the word nothing holds any more"); + assert_eq!(widened.words("only_a").len(), 1, "taken and given back inside one batch"); + } + + #[test] + fn qa_extra_empty_and_noop_batches_do_not_disturb_the_table() { + let held = [("/rtl/a.sv", "module a;\n logic w1;\n logic w2;\nendmodule\n")]; + let held_srcs: Vec<(PathBuf, String)> = + held.iter().map(|(p, t)| (PathBuf::from(*p), t.to_string())).collect(); + let index = WorkspaceIndex::build(held_srcs.iter().map(|(p, t)| (p.clone(), t.as_str()))); + let mut c = Candidates::build(&index, &held_srcs, HashMap::new()); + let before = c.words("").to_vec(); + + // Empty batch: nothing to absorb. + c.absorb(&index, Vec::new()); + assert_eq!(c.words(""), before.as_slice(), "empty batch changes nothing"); + + // Batch that re-declares exactly the same words for the same file + // (the module name "a" included, or dropping it would be a real + // change): no net change to the counts, so no add or drop should + // survive to the merge. + let batch: Vec<(PathBuf, Vec)> = vec![( + PathBuf::from("/rtl/a.sv"), + vec!["a".to_string(), "w1".to_string(), "w2".to_string()], + )]; + c.absorb(&index, batch); + assert_eq!(c.words(""), before.as_slice(), "re-declaring the same words is a no-op"); + } } diff --git a/crates/lucisv_server/src/perf.rs b/crates/lucisv_server/src/perf.rs index dedf112..70bb846 100644 --- a/crates/lucisv_server/src/perf.rs +++ b/crates/lucisv_server/src/perf.rs @@ -578,6 +578,100 @@ fn what_a_jump_into_a_new_folder_costs_before_and_after() { let _ = std::fs::remove_dir_all(&dir); } +/// `cargo test --release -p lucisv_server perf::what_a_widen_that_subsumes -- --ignored --nocapture --test-threads=1` +#[test] +#[ignore = "perf measurement, not a correctness assertion — see docs/perf/README.md"] +fn what_a_widen_that_subsumes_the_old_scope_costs() { + // `performance_take2.md` §5b, without opentitan: at the shipped + // `scopeDepth: 2` the first jump from a block's testbench into its own RTL + // raises the scope to the directory holding *every* block, which contains + // the one already in scope. The two things this prints are the two the + // report is about — how many files the widen actually reads (the new + // blocks, never the old one), and how long that takes against the whole + // rescan the same jump would otherwise cost. + let (blocks, rtl_each, dv_each) = (20, 25, 10); + let dir = std::env::temp_dir().join(format!("lucisv_perf_subsume_{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + for block in 0..blocks { + for (tag, folder, files) in [("r", "rtl", rtl_each), ("d", "dv/tb", dv_each)] { + let path = dir.join(format!("ip/blk{block:02}/{folder}")); + std::fs::create_dir_all(&path).expect("folder"); + for file in 0..files { + // `corpus_file`, not `generated_module`: every name in it is + // the file's own, so the workspace-wide word table grows with + // the file count the way a real one does. That is the whole + // point of this shape — a widen's cost is dominated by what it + // does to tables the size of the workspace, not by the folder. + std::fs::write( + path.join(format!("f{file:02}.sv")), + corpus_file(&format!("b{block:02}{tag}_f{file:02}"), 200), + ) + .expect("write"); + } + } + } + let tb = dir.join("ip/blk00/dv/tb/f00.sv"); + let rtl = dir.join("ip/blk00/rtl/f00.sv"); + let open = |ws: &mut Workspace, path: &PathBuf| { + let uri = path_to_uri(path).expect("uri"); + ws.set_document(uri, std::fs::read_to_string(path).expect("read")); + }; + // The shipped rung: depth 2, clamped by a root above `ip/`. + let depth_two = |ws: &mut Workspace| { + ws.set_client_settings(crate::settings::ClientSettings { + index_scope_depth: 2, + ..Default::default() + }); + ws.adopt_roots(vec![dir.clone()]); + }; + + let mut whole = Workspace::default(); + depth_two(&mut whole); + let mut incremental = Workspace::default(); + depth_two(&mut incremental); + for ws in [&mut whole, &mut incremental] { + open(ws, &tb); + ws.rebuild_index(); + } + let held = incremental.index().files().len(); + + open(&mut whole, &rtl); + let started = Instant::now(); + black_box(whole.rebuild_index()); + let rescan = started.elapsed(); + + let before = incremental.scope_dirs(); + open(&mut incremental, &rtl); + let added: Vec = + incremental.scope_dirs().into_iter().filter(|d| !before.contains(d)).collect(); + let mut read = 0usize; + let started = Instant::now(); + let mut scan = incremental.begin_widen(&added, &mut |_| {}); + while incremental.scan_step(&mut scan, &mut |_| read += 1) {} + // Split out because it is where the 2026-08-29 round's fix landed: folding + // a widen's words into the completion table used to move the table's tail + // once per new word, which is quadratic in the batch and was 40% of the + // whole cost on opentitan's `hw/ip`. + let landing = Instant::now(); + black_box(incremental.finish_scan(scan)); + let (finish, widen) = (landing.elapsed(), started.elapsed()); + + assert_eq!( + whole.index().fingerprint(), + incremental.index().fingerprint(), + "the two columns must describe the same index, or the numbers mean nothing" + ); + eprintln!( + "a widen that subsumes the old scope, {blocks} blocks of {} files:\n \ + scope {held} -> {} files; the widen read {read} of them \ + (the {held} already indexed are not re-read)\n \ + whole rescan {rescan:?}, subsuming widen {widen:?} (landing it: {finish:?})", + rtl_each + dv_each, + incremental.index().files().len(), + ); + let _ = std::fs::remove_dir_all(&dir); +} + /// The module-name families a completion prefix lands in, so a one-character /// prefix names hundreds of modules and a five-character one names a handful — /// the shape `performance.md`'s prefix table has on the real corpus. diff --git a/crates/lucisv_server/src/server.rs b/crates/lucisv_server/src/server.rs index 427e7df..aa057d3 100644 --- a/crates/lucisv_server/src/server.rs +++ b/crates/lucisv_server/src/server.rs @@ -2625,6 +2625,16 @@ enum Widen { /// costs no rescan at all), so the third arm is a rule kept rather than a case /// reached; a future shrink gets a correct answer instead of a subtle one. /// +/// **A directory that subsumes one already in scope is an add** (2026-08-29, +/// `docs/features/index-scope/README.md`). At `scopeDepth: 2` the second file a +/// user opens routinely raises to a *parent* of the directory the first one +/// raised to — opentitan's `hw/ip/aes` then `hw/ip`. That is still a pure add +/// here, because every opened directory is raised on its own and the list keeps +/// them all: the contained directory is in `after` beside the containing one, +/// and nothing was lost. The overlap is not re-read either, because +/// `Workspace::begin_widen`'s work list is diffed **by file against what the +/// index holds** rather than by folder against the old walk. +/// /// Both lists come from `Workspace::scope_dirs`, which sorts and dedups, so /// equality is set equality and `contains` is over a handful of directories. fn widen_of(before: &[std::path::PathBuf], after: &[std::path::PathBuf]) -> Widen { @@ -7490,6 +7500,19 @@ mod tests { Widen::Added(vec![a.clone(), c.clone()]), "two added around one held: both, and never the held one" ); + // The `scopeDepth: 2` shape `performance_take2.md` §5b measured: the + // newly opened file raises to a directory that *contains* one already + // in scope. The contained directory is still in `after` — every opened + // directory is raised on its own and none of them is ever dropped — so + // this is an add like any other, and the widen's own file diff is what + // stops the overlap being read twice + // (`state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds`). + let ip = PathBuf::from("/w"); + assert_eq!( + widen_of(std::slice::from_ref(&a), &[ip.clone(), a.clone()]), + Widen::Added(vec![ip]), + "a folder that subsumes the old scope is an add, not a removal" + ); assert_eq!( widen_of(&[a.clone(), b.clone()], std::slice::from_ref(&a)), Widen::Whole, diff --git a/crates/lucisv_server/src/state.rs b/crates/lucisv_server/src/state.rs index a2af725..d1100a3 100644 --- a/crates/lucisv_server/src/state.rs +++ b/crates/lucisv_server/src/state.rs @@ -5149,6 +5149,103 @@ mod tests { same_tables(&incremental, &rebuilt, "a widen into a containing folder"); } + #[test] + fn a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds() { + // opentitan's own shape, and the jump `performance_take2.md` §5b + // measured: at the shipped `scopeDepth: 2`, `ip/aes/dv/tb` raises to + // `ip/aes`, and the very next file — `ip/aes/rtl/aes.sv` — raises to + // `ip`, the *parent* of the directory already in scope. The new scope's + // file set is a superset of the old one, so the widen owes the other + // blocks and nothing else: `ip/aes`'s own already-indexed files are + // never re-read, and the diff that says so is by **file against the + // index**, not by folder against the old walk. + let tree = Tree::new("widensubsume"); + tree.package("ip/aes/rtl/aes.sv", "aes_pkg"); + tree.package("ip/aes/rtl/aes_core.sv", "aes_core_pkg"); + tree.package("ip/aes/dv/tb/tb.sv", "aes_tb_pkg"); + tree.package("ip/aes/dv/env/aes_env.sv", "aes_env_pkg"); + tree.package("ip/kmac/rtl/kmac.sv", "kmac_pkg"); + tree.package("ip/hmac/rtl/hmac.sv", "hmac_pkg"); + // Over the cap: not indexed before the widen, so it must not count as + // "already there" — it is walked again, skipped again, and reported. + tree.write( + "ip/kmac/rtl/huge.sv", + &format!("package huge_pkg;\n{}endpackage\n", " // pad\n".repeat(200)), + ); + + let aes = crate::uri::path_to_uri(&tree.path.join("ip/aes/rtl/aes.sv")).expect("uri"); + let tb = crate::uri::path_to_uri(&tree.path.join("ip/aes/dv/tb/tb.sv")).expect("uri"); + let aes_text = fs::read_to_string(tree.path.join("ip/aes/rtl/aes.sv")).expect("read"); + // An unsaved edit in a buffer that is *not* the one being opened: what + // makes the equivalence below a real claim rather than a coincidence. + let edited_tb = + "package aes_tb_pkg;\n localparam K = 1;\n localparam UNSAVED = 2;\nendpackage\n"; + let settings = + ClientSettings { index_scope_depth: 2, max_file_size: 512, ..Default::default() }; + + let mut incremental = Workspace::default(); + incremental.set_client_settings(settings.clone()); + incremental.open_roots(vec![tree.path.clone()]); + incremental.set_document(tb.clone(), edited_tb.into()); + incremental.rebuild_index(); + assert_eq!( + incremental.scope_dirs(), + [tree.path.join("ip/aes")], + "premise: the testbench raises two levels to its own block" + ); + assert_eq!(incremental.index().files().len(), 4, "premise: the block's four files"); + + let mut seen = Scan::default(); + let mut totals: Vec = Vec::new(); + let mut skipped: Vec = Vec::new(); + let added = { + let mut see = |event: IndexEvent| match event { + IndexEvent::Parsing { path, total, .. } => { + seen.parsed.push(file_name(path)); + totals.push(total); + } + IndexEvent::Cached { path, total, .. } => { + seen.cached.push(file_name(path)); + totals.push(total); + } + IndexEvent::Analyzed { path, total, .. } => { + seen.analyzed.push(file_name(path)); + totals.push(total); + } + IndexEvent::Skipped { path, .. } => skipped.push(file_name(path)), + }; + let before = incremental.scope_dirs(); + incremental.set_document(aes.clone(), aes_text.clone()); + let added: Vec = incremental + .scope_dirs() + .iter() + .filter(|dir| !before.contains(dir)) + .cloned() + .collect(); + incremental.widen_index_with(&added, &mut see); + added + }; + assert_eq!(added, [tree.path.join("ip")], "the added directory contains the old scope"); + seen.parsed.sort(); + // The two other blocks, and not one file of `ip/aes` — those the index + // already holds, and holding them is what the file diff is for. + assert_eq!(seen.parsed, ["hmac.sv", "kmac.sv"], "{seen:?}"); + seen.analyzed.sort(); + assert_eq!(seen.analyzed, ["aes.sv", "tb.sv"], "both buffers refresh: {seen:?}"); + assert_eq!(skipped, ["huge.sv"], "the capped file is walked and skipped again"); + assert_eq!(totals, [4, 4, 4, 4], "the bar counts the two new files and the two buffers"); + assert_eq!(incremental.index().files().len(), 6, "four held plus two new, never the cap's"); + + let mut rebuilt = Workspace::default(); + rebuilt.set_client_settings(settings); + rebuilt.open_roots(vec![tree.path.clone()]); + rebuilt.set_document(tb, edited_tb.into()); + rebuilt.set_document(aes, aes_text); + rebuilt.rebuild_index(); + assert_eq!(rebuilt.index().files().len(), 6, "premise: the same six files"); + same_tables(&incremental, &rebuilt, "a widen that subsumed the old scope"); + } + #[test] fn a_widen_lends_a_new_files_spelling_to_an_include_resolved_before_it() { // The include graph's own hostile case, and the reason this round diff --git a/docs/features/index-scope/README.md b/docs/features/index-scope/README.md index 2b7684b..557cdd5 100644 --- a/docs/features/index-scope/README.md +++ b/docs/features/index-scope/README.md @@ -150,6 +150,24 @@ that is provably a reporting decision with no effect on the index. as a whole rescan's overlay would; and a buffer that has grown past the large-file threshold is taken back out, which is the one thing a widen removes. +- **What "already indexed" means is the index's own file list, and that is the + whole of the rule (2026-08-29).** `begin_widen` walks the added directories + and skips every path `self.index.files()` already holds. Three things follow, + and all three are why the diff is by file rather than by folder: + - **a folder that contains one already in scope costs only its own new + files.** The two walks overlap completely over the old folder, and the + overlap is skipped file by file. + - **`.gitignore` and `exclude` differences between the old walk and the new + one cannot make it wrong.** A file the new root's walk finds and the old + one did not is simply not in the index, so it is indexed now; a file the + new walk *stops* finding is not taken out, because a widen removes nothing + it did not walk — which is the same trust in what is already indexed the + round above states, not a new gap. + - **the size cap keeps its meaning.** A capped file is not in the index, so + it is never "already there": every widen that walks it checks its size + again, skips it again, reports it again and counts it again. That is what + keeps the skip counts and the `size > cap` log honest on a widen, and it is + asserted in `a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds`. - **The residual staleness, stated honestly — and it is a narrowing, not a new window.** A whole rescan re-reads every in-scope file, so until this round a widening `didOpen` *incidentally* caught anything that had changed on disk @@ -344,6 +362,38 @@ Nothing takes a directory out of the folder scope today, so the third arm is a rule kept rather than a case reached. `reindex_widened` defers to `rescan_wanted` — one whole rescan — when a scan is already running. +**A directory that subsumes one already in scope is an add, and always was +(2026-08-29).** At `scopeDepth: 2` the routine second jump raises to a *parent* +of the directory the first one raised to — opentitan's `hw/ip/aes` then `hw/ip`. +That is a pure add here because `scope_dirs` raises **each opened directory on +its own and keeps every answer**: the contained directory is still in `after`, +beside the containing one, and nothing was lost. The rule as written is exactly +right for it, and the round that went looking for a bug here found the code +already correct and measured it to prove so +(`widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else`, subsumption +row). + +### `lucisv_server::candidates` — a batch of words is merged once (2026-08-29) + +`Candidates::absorb` is unchanged in signature and in answer, and changed in +cost: the workspace word table is a sorted `Vec`, and folding a batch in used to +insert each new word into it on its own — one memmove of the table's tail per +word, quadratic in the batch. It now counts the whole batch (`count_words`) and +brings the table back in step in one merge pass (`merge_words`). +`set_words` — the single-file door `update_words`/`remove_file` use — is those +same two calls, so there is one implementation and not two. + +The equivalence is by construction: `word_cmp` is a total order on distinct +words, so merging a sorted run into a sorted table is the sort a whole +`Candidates::build` would have run over the same counts. Pinned anyway by +`a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted`, whose +one batch carries every case the bookkeeping can get wrong — a word only one +file still holds, a word the batch takes from one file and gives back through +another, a word nothing holds afterwards, and case variants. **This is a file +outside this feature's usual set** (`candidates.rs` belongs to +`completion-core`); it is flagged in the work log as the round's one deviation, +and it is where the measured cost was. + ### `lucisv_server::candidates` — words from a token stream - `Candidates::build(index, sources, known: HashMap>)` @@ -448,6 +498,33 @@ rule kept rather than a case reached. `reindex_widened` defers to it out loud (`state::tests::own_folder_only`) instead of riding the default +### Round 22 — the first RTL open at the shipped depth (2026-08-29) + +- [x] Reproduced `performance_take2.md` §5b against the real checkout before + writing anything, and **corrected its diagnosis**: the jump takes the + widen path, the chooser's `Whole` arm is unreachable, and the widen reads + 1 685 files rather than 1 807 when the old block is inside the new root +- [x] The subsumption rule written down where it is decided (`widen_of`'s doc) + and pinned as a chooser row plus + `a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds`, which + is the only test in the crate that fails when the file diff is removed +- [x] The file diff's three consequences stated in Assumptions: the overlap, + the ignore-file differences, and the size cap +- [x] **The measured cost fixed**: `Candidates::absorb` merges a batch into the + word table once instead of inserting each word on its own — 403 → 43 ms + of the jump, warm **935 / 881 → 555 / 564 ms**, cold **1 529 → 1 175 ms** +- [x] Synthetic probe for the shape, no checkout needed + (`perf::what_a_widen_that_subsumes_the_old_scope_costs`), asserting the + widened index fingerprints identically to the whole rescan's +- [ ] **Filed, not done:** 325 ms of what is left is re-lexing the new files + for the completion word table. The persistent store holds a file's facts + and not its words; storing them is a `FACTS_FORMAT` change and belongs to + `index-persistence` (`TODO.md` §10) +- [ ] **Not done, deliberately:** the widen still does not interleave. It is + one bar per session per big widen, and `must_wait` holds requests behind + it either way — the same reasoning round 20 gave, restated now that the + bar is half a second rather than 20 ms + ### Round 19 — a rescan stops re-parsing what is already analyzed (2026-08-28) - [x] Traced where a scope-widening `didOpen`'s 213 ms actually goes, per stage, @@ -529,6 +606,136 @@ rule kept rather than a case reached. `reindex_widened` defers to ## Work log +### 2026-08-29 — dev agent (the first RTL open at the shipped depth) + +**The brief's diagnosis did not survive the first measurement, and that is the +round's first result.** The brief — from `performance_take2.md` §5b — was that +opening `hw/ip/aes/rtl/aes.sv` raises the scope to a root that *contains* the +folders already in it, that `widen_of` reads that as directories removed and +answers `Whole`, and that the resulting 1 807-file rescan re-indexes the 124 +files the old scope already held. Driven over stdio against +`/Users/guoliangchen/repo/opentitan` with the `HEAD` binary, `--verbose`, none +of that is what happens: + +```text +timing: widen started: 1 folder added: /Users/guoliangchen/repo/opentitan/hw/ip +timing: widen finished: 1685 files (0 skipped, 1683 from cache) in 933.73 ms +``` + +**1 685, not 1 807** — the 124 files of `hw/ip/aes` are not re-read — and it is +a *widen*, not a rescan. Both halves were already right, for reasons worth +writing down rather than rediscovering: + +- `scope_dirs` raises **every opened directory on its own and keeps every + answer**. Opening the RTL file adds `hw/ip` to a list that still contains + `hw/ip/aes`, so `before ⊆ after` and the chooser sees an add. Under the folder + rung `before ⊆ after` in fact always holds — `opened_dirs` only grows and + `raised` is a pure function of one directory — so `Widen::Whole` is + unreachable by `didOpen`, exactly as round 20 said it was. +- `begin_widen` has diffed **by file against `self.index.files()`** since round + 20. The overlap between the two walks is skipped path by path. + +So there was nothing to fix in the chooser. What this round did instead is pin +both facts (they were true by accident of two separate decisions, and nothing +failed if either moved) and then find where the second actually goes. + +**Where the second goes, warm store, stage by stage.** `hw/ip`, 1 807 files, all +of them cache hits: + +| stage | before | after | +|---|---:|---:| +| walk the added folder, read the new files | 100 ms | 100 ms | +| the scan loop (hash, decode, lex for words) | 405 ms | 405 ms | +| `index.absorb` | 31 ms | 31 ms | +| **`candidates.absorb`** | **403 ms** | **43 ms** | +| `includes.absorb` | 20 ms | 20 ms | + +**The 403 ms was the round's real find, and it is a quadratic.** `Candidates` +keeps the workspace word table as a sorted `Vec`, and `set_words` +inserted each newly-seen word into it with `Vec::insert` — a memmove of the +table's tail, once per word. One file's worth of words is nothing; a widen's +tens of thousands of new words against a table of a hundred thousand is +`O(new × held)`. `absorb` now counts the whole batch first and brings the table +back in step in a single merge pass, which is the same answer for the reason +merging is: `word_cmp` is a total order on distinct words, so a sorted run +merged into a sorted table is the sequence `Candidates::build`'s own sort would +have produced. `set_words` is the same two calls, so the single-file door and +the batch door are one implementation. + +**Deviation from the brief's file list, flagged for the lead.** The brief scoped +this round to `state.rs` and `server.rs`. The fix is in `candidates.rs`, which +belongs to `completion-core`. It is here because that is where the measurement +led, it is one function split into two, and nothing else in the tree was in +flight — but it is a file this feature does not own, and the Handshakes section +above says so. No signature changed and no caller moved. + +**End to end**, `--release` over stdio, the `HEAD` binary and this one +alternated in one session on one machine: + +| `didOpen` at the shipped depth | before | after | +|---|---:|---:| +| `hw/ip/aes/dv/tb/tb.sv` → `hw/ip/aes`, 124 files | 51 / 60 ms | 52 / 55 ms | +| `hw/ip/aes/rtl/aes.sv` → `hw/ip`, **1 685 new** | 935 / 881 ms | **555 / 564 ms** | +| the same jump, **cold** store (1 683 real parses) | 1 529 ms | **1 175 ms** | +| `kmac` / `hmac` / `spi_device` after it | 3–6 ms | 3–6 ms | + +The cold row is take 2's 1.4–1.7 s reproduced; take 2's figures were cold-store +ones. **The target was "low hundreds of ms warm" and this does not reach it**, +and the honest statement of why is that the rest is work rather than waste: 1 683 +files this index has never seen, 325 ms of which is lexing them for the word +table. The persistent store answers for a file's *facts* and not for its words, +so a cache hit still pays a full lex. Putting the word list beside the facts is +the next lever, it is a `FACTS_FORMAT` change, and it is filed in `TODO.md` §10 +rather than smuggled into this round. + +**Tests added (3), and what each is for.** + +| test | where | pins | +|---|---|---| +| `a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds` | `state.rs` | the round's subject, in opentitan's own shape at depth 2: the added directory contains the old scope; only the other blocks are parsed; both open buffers refresh (one carrying an unsaved edit); the over-cap file is walked, skipped and reported *again*; the bar counts four; and the tables equal a whole rebuild's | +| the subsumption row of `widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else` | `server.rs` | the chooser's answer for a containing directory, stated rather than inferred | +| `a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted` | `candidates.rs` | the merge == the sort, over one batch carrying a word only one file still holds, a word taken and given back inside the batch, a word nothing holds after it, and case variants | + +**Attacked before believing.** Two mutations, each run and each caught: deleting +`begin_widen`'s `held.contains` skip fails the new state test **and no other +test in the crate** — which is exactly why it was written; and turning +`merge_words`' first-touch bookkeeping into a plain `insert` (so a word given +back inside one batch is counted as new) fails the new candidates test with a +duplicated word. One `#[ignore]`d probe added, +`perf::what_a_widen_that_subsumes_the_old_scope_costs`, which asserts the +widened index fingerprints identically to the whole rescan's at the same scope. + +**The one path that could have paid for it was measured too.** `set_words` — the +single-file door `update_one` takes on every save — now runs the same merge +rather than one insert, so a save patches the word table with a pass over it +instead of a memmove inside it. Over opentitan with `hw/ip` in scope, four saves +of `spi_device.sv` each: **44–46 ms before, 40–41 ms after**. No regression, and +one implementation rather than a fast path and a slow one. + +**Files touched:** `crates/lucisv_server/src/candidates.rs`, +`crates/lucisv_server/src/state.rs` (test only), +`crates/lucisv_server/src/server.rs` (doc + test only), +`crates/lucisv_server/src/perf.rs`, this README, `docs/perf/README.md`, +`TODO.md`. No new dependency, no `unsafe`, no `#[allow]`, no signature change, +no scope-semantics change, no version bump, no commits. + +**Verification.** `cargo fmt --all -- --check`: clean. `cargo clippy +--all-targets --workspace`: zero warnings. `cargo test --workspace`: **2 542 +passed, 0 failed** (2 540 on `HEAD`, measured in a checkout of it — 2 new). +`cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`: +`smoke: OK`. `node editors/vscode/restart_test.js target/debug/lucisv-server`: +`restart: OK — 44 checks over the restart chain`. + +**How the opentitan pair was taken, so it can be re-taken.** `git archive HEAD | +tar -x -C /tmp/lucisv-before && cargo build --release -p lucisv_server` there +gives the "before" binary; a stdio probe (in the session scratchpad — nothing in +the tree may depend on that checkout) drives each binary with `--verbose`, +opens the four files in order and times the request sent straight after each +`didOpen`, reading the `timing: widen …` lines back off `window/logMessage`. The +cold rows were taken by moving `~/Library/Caches/lucisv/index` aside for one run +of each binary and restoring it afterwards. Both binaries were run twice, +alternated, in one session on one machine. + ### 2026-08-28 — dev agent (the shipped `scopeDepth` moves 0 → 2) **A behaviour change, lead-decided, and it belongs in the release notes.** The @@ -1537,8 +1744,161 @@ green), `node editors/vscode/smoke.js target/release/lucisv-server` — clean. No fixes applied; no new tests needed in this feature's own files (the existing round-21 test suite already covers what I attacked). No commits. +### 2026-08-29 — QA agent (round 22: subsumption is an add, and the merge that fixes it) + +**Verdict: SHIP.** The dev's refutation of the brief's diagnosis holds up under +attack, both pinned properties genuinely bind what they claim to, the +`merge_words` rewrite is equivalent to a whole build over every hostile shape +tried, and the perf claims reproduce on the real checkout to within run-to-run +noise. No corruption, no idempotency break, no dropped comment — not this +round's concern, but checked by inspection since `candidates.rs` is outside +this feature's usual set. + +**Chooser and file-diff mutation attacks, each isolated and reverted.** + +- Mutated `Workspace::scope_dirs` (`state.rs:629`) to collapse a subsumed + directory into its containing one — simulating the brief's own (refuted) + model of the world, where a contained directory disappears from the list. + **Neither of this round's two new tests caught it**: + `server::tests::widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else` + constructs its `before`/`after` `PathBuf` lists by hand and never calls + `scope_dirs`, and `state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds` + computes its own `added` list by filtering `scope_dirs()`'s two snapshots + rather than routing through `widen_of`, so a collapsed list still yields the + same `added` by coincidence. What *did* catch it, over the full workspace + suite, is the pre-existing `server::tests::a_didopen_rebuilds_exactly_when_it_widens_the_scope` + (`left: 4 right: 5` — one fewer rebuild than expected). Not a gap: the two + new tests are unit tests for two separate pieces (the chooser as a pure + function; `begin_widen`'s file diff given a correct `added`), and the + full-path property is what the older integration-shaped test is for. Stated + here so it isn't rediscovered as a false alarm. +- Mutated `widen_of` itself (`server.rs:2640`) to collapse `after` by + containment before comparing against `before` — the same brief-shaped bug, + applied inside the chooser instead of at its input. Caught: **exactly** + `server::tests::widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else` + fails, on the new subsumption row (`left: Whole, right: Added(["/w"])`); no + other test in the crate moves. +- Deleted `begin_widen`'s `held.contains(&path) { continue; }` skip + (`state.rs:1002`). Caught: **exactly** + `state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds` + fails (`aes_core.sv`/`aes_env.sv` — the old block's own files — reappear in + `seen.parsed`); no other test in the crate moves. Matches the work log's own + claim verbatim. + +Together: the chooser row and the state test each bind exactly one of the two +properties the work log calls "true by accident of two separate decisions," +not both — and the reason that's fine is the older `a_didopen_rebuilds_...` +test binds the composition of the two. All three mutations reverted; final +`git diff` of `state.rs`/`server.rs` matches the pre-attack diff exactly. + +**`merge_words` mutation attack.** Changed `count_words`' first-touch +bookkeeping (`touched.entry(word).or_insert(...)`) to plain `touched.insert(word, +...)` on both the removal and the addition arm — so a word the batch takes from +one file and gives back through another is (wrongly) recorded as newly added +rather than as never having moved. Caught: **exactly** +`candidates::tests::a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted` +fails, with the duplicated words spelled out in the assertion output +(`"a", "a", ..., "only_a", "only_a", ..., "Shared", "Shared", ...`) — plus one +pre-existing test, +`candidates::tests::updating_the_same_file_twice_in_a_row_never_double_counts_or_goes_negative`, +which is extra coverage the work log didn't claim but is a welcome bonus. +Reverted; `candidates.rs` diff (minus the one test I kept, below) matches the +pre-attack diff. + +**Extra coverage added, one test, `candidates.rs` (permanent).** The brief's +attack list named "empty batches" and "a batch where every word is already +present" as hostile shapes; the round's own test covers duplicate/moved/gone/ +case-variant words but not either of these two. Added +`qa_extra_empty_and_noop_batches_do_not_disturb_the_table`: an empty +`absorb(&index, Vec::new())` and a batch that re-declares one file's words +unchanged (module name included — the first version of this test omitted it +and correctly failed, since dropping a real word is a real change, not a +no-op; fixed before landing it) both leave `words("")` byte-identical to +before. No bug found — `merge_words`'s `if added.is_empty() && dropped.is_empty() +{ return; }` early-out (`candidates.rs`) already handles both correctly — but +the charter asked for the attack and it is now a permanent regression rather +than a one-off check. + +**Perf probe's fingerprint assertion, verified real.** Mutated `widened_files` +(`state.rs:1074`) to `.pop()` one file off the end of its own walk, simulating +a widen that silently skips a file. `cargo test --release -p lucisv_server +perf::what_a_widen_that_subsumes -- --ignored --nocapture --test-threads=1` +fails on the assertion the round added +(`assert_eq!(whole.index().fingerprint(), incremental.index().fingerprint(), ...)`), +dumping both fingerprints and diverging at the missing file. Reverted. Ran the +probe clean afterwards: + +``` +scope 35 -> 700 files; the widen read 667 of them (the 35 already indexed are not re-read) +whole rescan 662.558333ms, subsuming widen 645.5425ms (landing it: 52.5085ms) +``` + +Close columns confirmed as honest, not a bug: this synthetic tree has no +persistent-store warm-up (a fresh temp directory every run, so both columns +pay a genuinely cold parse of most of their files) — the win the round +actually bought is in "landing it" (`candidates.absorb`'s merge), which is +what the opentitan table is for. + +**Opentitan reproduction, both binaries, from scratch.** `git archive HEAD | +tar -x -C /tmp/lucisv-before && cargo build --release -p lucisv_server` for the +pre-round binary; `cargo build --release -p lucisv_server` in this tree for +the post-round one. Wrote a fresh stdio probe (this session's scratchpad, +`opentitan_probe.js`, modelled on `editors/vscode/smoke.js`'s framing) against +`/Users/guoliangchen/repo/opentitan` (1 807 `hw/ip` files, confirmed by `find` +— matches the brief exactly), pushing `scopeDepth: 2` and timing each +`didOpen` to its `publishDiagnostics`. Warm store, two runs per binary, +alternated: + +| `didOpen` at `scopeDepth: 2` | before (`HEAD`) | after (this round) | +|---|---:|---:| +| `hw/ip/aes/dv/tb/tb.sv` → `hw/ip/aes`, 124 files | 42.9 / 42.3 ms | 42.7 / 46.8 ms | +| `hw/ip/aes/rtl/aes.sv` → `hw/ip`, 1 685 new | **872 / 876 ms** | **535 / 542 ms** | + +Both runs logged `widen finished: 1685 files (0 skipped, 1683 from cache)` — +matches the work log's own 1 685 (not 1 807) exactly. The before/after gap +(872–880 → 535–546 ms) reproduces the claimed **935/881 → 555/564 ms** within +the alternation's own run-to-run spread; did not re-take the cold-store row +(moving `~/Library/Caches/lucisv/index` aside on a checkout this session +doesn't own felt like the wrong thing to disturb without asking, and the warm +row already carries the round's claim). + +**Full gates, re-run clean on the round's actual diff** (`state.rs`/`server.rs` +restored byte-for-byte after every mutation attack above; `candidates.rs` +carries only the one extra test noted above beyond the round's own diff). +`cargo fmt --all -- --check`: clean. `cargo clippy --all-targets --workspace`: +zero warnings. `cargo test --workspace`: **0 failed** (exit 0); +`lucisv_server`'s own binary: 1291 passed, 34 ignored (1289 on the round's diff +alone, +2 for the `qa_extra` test and the dev's own count already included). +`cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`: +`smoke: OK`. `node editors/vscode/restart_test.js target/debug/lucisv-server`: +`restart: OK — 44 checks over the restart chain`. + +**Not re-verified in depth:** the TODO.md §10 follow-up lines for `codeAction` +and `inlayHint` (correctly unchecked, correctly cite `performance_take2.md`, +correctly not fixed here) — cross-checked against the source document's §6a +and §7/§8 numbers by direct comparison, word for word, and they match. + ## Review +### 2026-08-29 — lead, subsumption round + +Reviewed after QA's SHIP; gates re-run (fmt clean, 1292 server tests +green). The round's real contribution is epistemic: the brief's +diagnosis — mine, built on take 2's cold-store numbers — was half +wrong, and the dev proved it with the HEAD binary before writing a +line of fix. The chooser and the file-diff were already correct; what +was quadratic was folding a widen's words into the sorted table one +insert at a time (403 → 43 ms), and what was unpinned were the two +accidental properties the diagnosis would have needed to break. QA's +mutation matrix — five mutations, each caught by exactly the test +that claims to bind it — is the standard the parallel-lane loop +should hold every pin to. The warm RTL jump lands at ~545 ms, the +target missed honestly: the residual is 1 683 genuinely new files and +a 325 ms word re-lex the store cannot yet answer, filed as the +FACTS_FORMAT follow-up rather than hidden. Take 2's regression entry +stands corrected in the work log: cold-store cost, not a chooser bug. +Accepted; committed by the lead. + ### 2026-08-28 — lead, performance-wave Lane B (scope default) The scopeDepth 0 → 2 default is the lead's own decision implemented diff --git a/docs/perf/README.md b/docs/perf/README.md index 268cb2c..6c26522 100644 --- a/docs/perf/README.md +++ b/docs/perf/README.md @@ -645,6 +645,70 @@ rework, so the tables describe the shipped code. The pre-rework round measured the same corpora: the sixth rung is inside the run-to-run noise, which the separate rung measurement says directly rather than by subtraction. +## Before / after — round 8 (2026-08-29) + +`performance_take2.md` §5b: the first F12 from a testbench into its own RTL at +the shipped `scopeDepth: 2` raises the scope from one IP block to the whole of +`hw/ip`, and take 2 measured 1.4–1.7 s of frozen loop for it. + +**The diagnosis in the brief did not survive the measurement, and that is the +first result.** The widen was *not* falling back to a whole rescan and was *not* +re-indexing the block it already held: with `hw/ip/aes` already in scope, the +jump's bar reads **1 685 files, not 1 807**, and every one of them is a file the +index did not hold. `widen_of` sees an add (the contained directory stays in the +list beside the containing one) and `begin_widen` diffs **by file against the +index**. Both are pinned by tests this round rather than left to be re-derived. + +**What the second was actually paying for**, `hw/ip` at the default scope, warm +store, stage by stage: + +| stage of the 1 807-file widen | before | after | +|---|---:|---:| +| walk the added folder and read the new files | 100 ms | 100 ms | +| the scan loop (hash, decode the records, **lex for words**) | 405 ms (325 of it the lex) | 405 ms | +| `index.absorb` | 31 ms | 31 ms | +| **`candidates.absorb`** | **403 ms** | **43 ms** | +| `includes.absorb` | 20 ms | 20 ms | + +The word table is a sorted `Vec`, and the widen inserted each new word into it +on its own — one memmove of the table's tail per word, quadratic in the batch. +Counted per batch and merged in one pass, it is 9× cheaper and the answer is +the same table `Candidates::build` sorts from the same counts. + +End to end, `/Users/guoliangchen/repo/opentitan`, `--release` over stdio, the +`HEAD` binary and this one alternated in one session, timing the request sent +straight after each `didOpen`: + +| `didOpen` at `scopeDepth: 2` | before | after | +|---|---:|---:| +| `hw/ip/aes/dv/tb/tb.sv` (widens to `hw/ip/aes`, 124 files) | 51 / 60 ms | 52 / 55 ms | +| `hw/ip/aes/rtl/aes.sv` (raises to `hw/ip`, **1 685 new**) | 935 / 881 ms | **555 / 564 ms** | +| the same jump on a **cold** store (1 683 parses) | 1 529 ms | **1 175 ms** | +| `kmac`, `hmac`, `spi_device` after it (already in scope) | 3–6 ms | 3–6 ms | + +The cold row is take 2's own 1.4–1.7 s reproduced. **What is left is real +work**: 1 683 files this index has never seen, of which 325 ms is re-lexing +them for the completion word table — the persistent store holds a file's facts +but not its words, and putting them there is a `FACTS_FORMAT` change, filed in +`TODO.md` §10. The widen still does not interleave, so this is one bar the user +watches, once per session per big widen. + +Reproducible without that checkout: +`perf::what_a_widen_that_subsumes_the_old_scope_costs` generates 20 blocks × +(25 rtl + 10 dv) files whose every name is its own file's, opens a testbench and +then its RTL sibling at depth 2, and asserts the widened index fingerprints +identically to the whole rescan's: + +```text +scope 35 -> 700 files; the widen read 667 of them (the 35 already indexed are not re-read) +whole rescan 664 ms, subsuming widen 653 ms (landing it: 62.9 ms before, 51.8 ms after) +``` + +The two columns being close is honest and is the point of the shape: when the +subsuming folder is twenty times the old scope, skipping the overlap saves 5 %. +What the round bought is in the landing figure, and it grows with the workspace's +vocabulary — which is why the opentitan table above is the one that matters. + ## What it would take to go faster Ranked by what the measurements above say is there, with what each would @@ -748,6 +812,11 @@ cost. None of these were attempted; each is a future round. - [x] **Added in round 7 (2026-08-28):** what the shipped `lucisv.index.scopeDepth` costs and buys, rung by rung, on an opentitan-shaped tree (`perf::what_the_scope_depth_default_costs`). +- [x] **Added in round 8 (2026-08-29):** what a widen that *subsumes* the + folder already in scope costs, at the shipped depth, with the files it + actually reads reported beside the scope's size and the landing of the + scan timed on its own — the stage the round's fix is in + (`perf::what_a_widen_that_subsumes_the_old_scope_costs`). - [ ] Not measured: signature help and semantic tokens end to end. Each has a whole-buffer pass somewhere; only their token lookups have ever been measured. Completion was the third of that list and is now done — and it