# Independent review of 0.52.0 — performance follow-up implementation Reviewed 2026-09-09 at `3ceba21bb2ef4404a188b076301b170af862075b`, against 0.51.0 at `126a6bcdac99e940534c87bce94a5269cdc53ae4`. **The main performance improvements are reproducible, but this round needs a startup correctness fix and two benchmark fixes.** A split startup scan can index a symlinked directory twice and make a valid rename appear ambiguous. The new loaded-scan harness also mislabels an unprimed first trial as warm and miscomputes its scan-completion/within-scan classification. The latency gains below use properly warmed reruns and server-reported scan durations, avoiding those measurement errors. **Status (2026-09-09): F1, F2 and F3 fixed in 0.53.0 (TODO §62; `docs/features/perf5r-first-answer/README.md`, `perf5r-publication/README.md`); N1–N3 deferred to loop 3.** No implementation was changed by this review itself. [The tracking file](perf/take5-tracking.md) records the findings and remaining goals. [Evidence, reproductions and commands](perf/review-052-20260909/README.md) are preserved separately from the implementation agent's results. ## Findings ### F1 · P2 · Split startup discovery duplicates modules behind directory aliases **Where:** `crates/lucisv_server/src/state/discover.rs`, `first_scope` around lines 445–462 and the path-only filtering in `walked_rest`/`rest_of_scope`; `crates/lucisv_core/src/walk.rs::collect_files_below` creates an independent directory-identity set. The regular walker visits each directory identity once and reports files under the first path spelling that reaches it. The new neighbourhood walk and the remaining root walk have separate visited sets. Their results are combined using `HashSet`, which cannot recognize two paths to the same directory. Copying the ancestor ignore stack preserved exclusions but did not preserve the walk's alias/cycle identity contract. **Reproduction**, using only a scratch fixture: ```text workspace/ a_alias -> z_real z_real/ child.sv # module child; endmodule tb.sv # module tb; child u(); endmodule ``` Start with `index.scope = "workspace"`, `index.scopeDepth = 0`, and open `z_real/tb.sv`. After the startup scan settles, request definition and prepareRename at `child`. | Observation | 0.51.0 | 0.52.0 | |---|---|---| | Definition after startup | One target: `a_alias/child.sv` | Two targets: alias and real path | | prepareRename after startup | Accepted | Refused: `child` is declared in more than one indexed file | | After a whole rescan, without changing source text | One target; rename accepted | One target; rename accepted | The initial definition difference reproduced in **3/3 sessions per version**, and the complete startup/rescan lifecycle reproduced in another **3/3 per version**. A watched-file notification naming both fixture files triggered the whole rescan. The source bytes did not change. Thus startup and subsequent scans disagree about the same project, and the effect is user-visible beyond duplicate navigation entries: rename is blocked until a rescan. **Required fix:** preserve the root walk's directory identity and path-selection policy across split discovery. Simply keeping a separate path set for each half, or deduplicating declarations by module name, is insufficient. A bounded fallback is acceptable where equivalent discovery cannot yet be guaranteed. The `HEAD_WALK_MAX` fallback also unions the independently discovered head, so increasing or lowering that limit alone does not repair the contract. **Acceptance:** compare the actual index paths, definitions, prepareRename results and diagnostics after startup, a whole rescan, and restart. Cover an alias sorting before/after its target, multiple aliases, an ancestor cycle, ignore rules and an open unsaved buffer. Keep legitimate duplicate declarations ambiguous. Record the amended walker/server handshake in [topo.md](topo.md). Add this fixture to the shipped regression tests; the existing successful corpus probes do not cover it. ### F2 · P2 · A fresh “warm” scanload run includes a cold trial **Where:** `tools/perf/phases_r4.py::load_cell`, around lines 239–249. The function sets `cold=False` for a warm cell but never primes its storage. `Session.__enter__` creates a missing directory; it does not populate an index cache. Consequently a standalone `scanload` or `scanloadprobe` command with a new `--storage` directory measures a cold first trial and warm later trials under one warm label. This happened in the initial paired `scanloadprobe` invocation in this review. A separate two-session proof on 0.52.0, with `cold=False` both times, recorded: | Trial | Directory existed beforehand | Index cache hits / misses | Scan parse time | |---|---|---:|---:| | First | No | **0 / 3,974** | **1,684 ms** | | Second | Yes | **3,974 / 0** | **0 ms** | The two open buffers account for the rest of the 3,976-file workspace. The initial load-probe rows remain in the evidence but are **excluded from warm comparisons**. `load-retest.jsonl` contains the properly warmed paired replacement. Other cold/warm matrix phases explicitly run their cold cells first; they are not excluded on this basis. This does not establish that every historical implementation run was unprimed; it establishes that the standalone harness cannot enforce its label. **Required fix:** perform an untimed prime using the same scope, buffers and corpus before a warm cell, or explicitly validate a complete pre-existing cache. Record cache hits/misses per timed trial and test the command with a brand-new storage directory. Merely creating the directory is not a prime. ### F3 · P2 · scanload completion and mid-scan fields include the request window **Where:** `tools/perf/phases_r4.py::settled_at`, lines 136–139; consumed by `summary` around lines 179–200. The candidate's corrected warm runs report actual server scan durations of **1,778 / 1,771 / 1,765 ms**, yet `settled_ms` is **3,406 / 3,407 / 3,407 ms** and all **105** responses are classified as mid-scan, with zero after-settle answers. The fixed request window sends its last request near 3,400 ms, well after these scans end. `settled_at` calls `wait_quiet` after the request window and substitutes that call's entry time whenever the returned value is positive. `wait_quiet` initializes `last` with a separate clock read after `started`, so even no new notification usually yields a tiny positive value. It also counts all notifications, including verbose request timing messages. The previously captured scan-only `quiet_at` therefore gets replaced with approximately the end of the offered-load window. This makes the faster server's completion and mid-scan classification wrong. **Required fix:** timestamp scan-completion events independently of client request/timing traffic. Distinguish “no new scan event” explicitly rather than testing a clock delta for exact zero. Classify each response using that same completion boundary; retain response arrival timestamps in the raw evidence. Test a scan that finishes well before the fixed window ends, and a longer offered window with the same initial load: scan completion should remain stable while the after-settle count grows. **Treatment in this review:** use `publication[].scan_total` for scan duration and ordinary wire latencies over the **entire fixed window** for request wait. Do not use `settled_ms`, `mid_scan_median_ms` or `after_settle_answers` as reliable scan-only metrics. The offered/answered counts and settled-target comparisons remain useful. ## Paired performance results All times are milliseconds unless marked otherwise. Ordinary request cells use the median of three repeats following a first request. Startup/RSS cells use three processes. Rename rows run verbose on both versions so their parse counts and work attribution can be compared. The original 0.51.0 review's numbers are historical context; the comparison below is freshly paired. The first-useful-answer target is measured with the one-buffer AES fixture. It is not a bound on every opening set or on the loaded two-buffer case below. | Workload | 0.51.0 | 0.52.0 | Assessment | |---|---:|---:|---| | Pinmux comment, unchanged all-family menu | 24.3 | **0.32** | Repeated lint work removed; ≤16 ms goal met | | Definition queued behind that menu | 24.4 | **0.29** | Menu blocking largely removed | | Pinmux first menu after didChange | 137.8 | **113.6** | Improved; substantial dirty-buffer work remains | | Tail `state_q` rename | 391.8 | **324.6** | **17.1% lower**, 240 → 137 parses | | Ordinary `aes` rename | 92.0 | **93.0** | Essentially unchanged | | Common-port `clk_i` rename | 3,482.9 | **2,883.7** | 17.2% lower; still a long blocking command | | Duplicate-module refusal | 2,206.5 | **754.0** | 66% lower; 3,975 → 14 parses | | No-symbol refusal | 2,204.6 | **0.22** | Preflight succeeds; 3,975 → 0 parses | | First useful definition, cold | 278.6 | **84.4** | ≤200 ms goal met at this cursor | | First useful definition, warm | 294.5 | **118.5** | ≤200 ms goal met at this cursor | | Quiet workspace scan, cold | 2,884.9 | **2,886.6** | Unchanged; 2.3 s aspiration remains unmet | | Quiet workspace scan, warm | 1,074.0 | **1,064.7** | Essentially unchanged; sub-second result not reproduced | | Warm idle RSS, MiB | 419.8 | **418.0** | Prior memory gain retained | | Connect-missing-ports resolve | 132.9 | **130.2** | Similar; no broad refactor speedup claimed | | Successful extract edit computation | 148.5 | **146.7** | Similar; captured edit matches | | Refused extraction at inline-site selection | 790.1 | **806.6** | Still about 0.8 s; no demonstrated improvement | The initial tail rename on 0.52.0 was 359 ms before the 325 ms repeat median. Common-port peak process RSS remained about **1.8 GiB** (1.79 → 1.78 GiB in these samples). Some refusal peaks rose in this run; for example, the heavily used new-name collision rose about 5%, while no-symbol and duplicate-module refusal peaks fell substantially. These sampled peaks do not establish a leak or statistically significant regression, but they do not support an unconditional claim that every request's peak memory always decreases. The implementation ledger already acknowledges the ≥20% **paired** tail-rename goal was missed at 17.4%. This rerun agrees at 17.1%. Comparing against the older 398 ms report to obtain a larger percentage does not replace a paired comparison. The work reduction is useful and worth retaining; label the target honestly. ### Fixed offered load, with cache warmth corrected For the normal definition cursor, **two open buffers**, one request every 100 ms, 35 requests per process, three processes per version: | Metric | 0.51.0 | 0.52.0 | |---|---:|---:| | Median request wait, entire fixed window | 1,947 ms | **2.03 ms** | | Worst sampled request wait | 3,675 ms | **722 ms** | | Median server-reported scan duration | 4,247 ms | **1,771 ms** | | Publishes per process | 34 / 34 / 34 | **4 / 4 / 4** | | Requests answered | 105 / 105 offered | **105 / 105 offered** | | Answers differing from settled target | 0 | **0** | These support the publication-cadence optimization. The request median includes answers after the candidate has completed its scan; it is not a “median while indexing” claim. The separately measured scan duration and unchanged offered load show why the complete fixed-window experience improves. The cross-folder cursor was tested cold and warm with one and eleven open buffers. The candidate answered **750/750** requests and all matched the settled target; the reference produced **399 premature empty answers** among its 750 responses. Non-empty mismatches were zero on both. This confirms the empty-answer retry behavior on the sampled workload. Some cross-folder maxima are higher: with one buffer, **277 → 482 ms cold** and **306 → 380 ms warm**. With eleven buffers, the cold maximum instead fell from **9,261 → 1,863 ms**. Correctness and tail delay must be reported together; a fast empty response is not a fast useful definition. The implementation's accepted single-buffer cadence tradeoff remains relevant. ## Implementation assessment and next actions 1. **Fix F1 before treating the round as fully closed.** It violates startup/rescan scope equivalence and blocks a valid rename. Preserve the performance work while repairing directory identity and adding the alias regression matrix. 2. **Fix F2 and F3 before using scanload to accept the next optimization.** Keep explicit cold/warm setup, true scan completion, full-window latency, within-scan latency and result quality as separate measurements. Recheck any earlier cells whose cache provenance or completion metric is unclear; do not assume all historical numbers are wrong. 3. **Keep the lint snapshot.** Its key includes the effective rules/options, line length, tab width, oracle presence and waiver contents; the slot belongs to a document revision and is cleared on overlay refresh after index mutations. The source implements the dependency contract requested in the prior plan. The remaining 114 ms first-edit cost needs buffer parse/analysis work reduction; another unchanged-result cache cannot eliminate it. 4. **Keep the engine-owned preflight and content-tied facts reuse.** Preflight avoids index-derived early refusals, preserving the fresh-source authority of the full rename. KnownFacts comes from a store entry tied to the handed source bytes; `check/` is unchanged. The tail trace now attributes about **163 ms to initial scope construction**, including **31 ms of facts decoding**. The common-port command still parses 1,251 files and takes 2.88 s; lexer/parser work on retained analyses is the next significant target. Preserve warning/refusal/output parity and measure peak memory rather than retaining all token streams indiscriminately. 5. **Keep startup ordering and publication cadence, subject to F1.** First-answer latency now meets the proposed target. Quiet warm throughput remains around one second, and cold throughput remains 2.9 s. Whole-index absorb/decode/candidate construction are still follow-ups, not completed gains in this review. Reduce publication cost itself before tightening cadence in a way that restores the old merge-per-burst cost. ## Scope and evidence Both release servers were built before timing, using the same compiler and the current harness for both versions. The reference was exported to a scratch directory with `git archive`; no checkout, branch or remote was changed. All benchmark phases ran sequentially under the repository's 8 GiB / 1,800-second guard, with no build/test overlap. OpenTitan stayed at `00981352642fb65ef2b6c47143a0f6bb31fd4a97` with its same three pre-existing modified files; their hashes match the prior review. Edits were captured/discarded, and all caches were outside the corpus. This review covers menu filters, queued navigation, first-after-edit requests, eight rename shapes, startup scope/cache cells, RSS, two fixed-load probes, resolved actions and command execution. CLI throughput, the eager non-resolving client and the full 101-buffer load matrix were not remeasured. Three process trials establish practical direction and reproductions, not population tail percentiles or statistical significance. **Independent validation:** `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets --locked -- -D warnings` passed. The default full workspace suite (`cargo test --workspace --locked`) finished with **4,374 passed, 0 failed, 45 ignored**, including doc-test result blocks. The ignored tests were not forced on. No guard limit was hit. All **84 comparable non-load outcome rows** matched on their recorded status, fingerprint, message, titles/shapes, edit/file/create/result counts and warnings where present. This is not a new full rename-warning oracle run; the implementation's wider warning checks remain in its own QA evidence. The new alias reproduction fails startup equivalence despite the existing suite passing, demonstrating a coverage gap. Final corpus status/hashes and both release-binary hashes were unchanged. One-minute load samples during the initial paired phases were approximately 3.87–5.98; small timing movements are not treated as established regressions.