33 KiB
Performance take 5 — latest analysis and implementation plan
Recommendation: optimize code-action discovery first, then reuse rename/refactoring analysis, then remove CLI package-census duplication. A newly measured no-offer comment cursor in a generated file blocks navigation for about 300 ms. The earlier small-file measurements hid this size-dependent cost. Hierarchical rename still costs about 0.8 seconds. Startup and resident memory remain secondary targets.
Status (2026-09-08): implemented as TODO §60 — P0, P1a–c, P2a–c (P2d measured, no narrowing: proof negative), handshake 33, P3, P4a–b; results in docs/perf/README.md's 2026-09-08 entry and the tracker. This document is the plan as the owner wrote it, kept unedited below; it was not an implementation when written. The implementation agent should fill the performance tracker. Raw results, exact commands/provenance and the read-only supplemental probes are preserved in take5-baseline.
Scope and confidence
- Measured 0.50.0, local HEAD
bbdbfe9045e8a85f8ea471529ea739af6cade77f, on 2026-09-07. “Latest” here means the current checkout; no remote was fetched or changed.cargo build --release --locked -p lucisv -p lucisv_serverconfirmed release artifacts were current before timing. - Same OpenTitan commit as take 4:
00981352642fb65ef2b6c47143a0f6bb31fd4a97, with the same three pre-existing modified files. All commands treated corpus text as read-only; edits were discarded. Corpus status was unchanged after every standard phase and CLI trial, and after the supplementary probe. End-of-run hashes of modified files are in the provenance record. - Same M1 Max machine described in the previous report, macOS 27.0 build
26A5425a. Standard-phase one-minute load samples were 2.92–4.59. No builds overlapped benchmarks. Retained runs used the repository's 8 GiB / 1,800-second guard; an initial sandbox run whose guard could not read process memory was discarded and rerun with the guard operating. No guard kill occurred. - Standard phases: baseline, codeaction, tailrename, blockers, didopen, scan, rss, refactor, rename, flush, diagnostics, completion and nav. Added read-only action-family/large-file probes and a paired CLI experiment on
hw/ip. Other CLI trees, actual inline/extract command execution, allocation profiles and parser-stage timings were not remeasured. git diff v0.49.0..HEAD -- crates/shows production changes only in CLI format-cache key handling and the core cache. The server/parser/semantic/refactor implementation did not change. Therefore the old 0.49.0 LSP column below is historical context, not a controlled regression comparison. Small timing movements do not establish a 0.50.0 regression. CLI binaries 0.43.0, 0.49.0 and 0.50.0 were measured in the same experiment with alternating binary order.- Four request samples normally mean first request plus three repeats within one session. Scan and file-open rows use three fresh processes. These small samples support prioritization, not p95/p99 or statistical significance. The supplemental action filters were tested sequentially within each file's session; their timing differences are approximate attribution controls, not a CPU profile.
Current measurements and what they imply
All latencies are milliseconds unless marked otherwise. Warm workspace scope, resolving/lazy client unless stated. Historical values come from take 4, whose results in turn compare take 3.
| Scenario | 0.49.0 historical first / repeats | 0.50.0 first / repeats | Meaning |
|---|---|---|---|
No-offer comment, 42,192-line pinmux_reg_top.sv |
not measured | 328.4 / 296.8–311.7 | Highest-priority newly exposed interactive cost; zero actions |
| Definition queued behind that comment action | not measured | 300.7–304.1, three pipelines | Essentially the whole blocker cost |
state_q rename through instance tail |
793.2 / 750.7–751.9 | 821.6 / 789.5–809.8 | Two edited files; heavy user-command path persists |
Eager code action, prim_flop_2sync (fan-out 128) |
511.8 / 467.1–473.6 | 518.3 / 495.6–499.7 | Expensive fallback remains; prior owner classified it non-hot |
Lazy aes_reg_top offer |
29.8 / 21.8–23.5 | 32.8 / 22.4–25.1 | Local offer work can exceed a frame even at fan-out 1 |
Lazy aes offer |
14.2 / 7.9–9.8 | 12.4 / 8.1–9.1 | Still repeated work on a frequent request |
No-offer tb.sv comment |
4.7 / 3.2–3.8 | 6.2 / 3.2–3.5 | Small-file version of the same unnecessary work |
Ordinary aes rename |
165.1 / 133.5–139.4 | 168.7 / 139.3–140.4 | Nine edited files; not explained by output count alone |
| Resolve connect-missing-ports action | 163.9 / 158.2–159.5 | 170.8 / 164.8–165.8 | A click in a lazy client still pays engine work |
Resolve expand .*, 32 connections |
67.8 / 66.9–67.0 | 73.0 / 70.4–70.7 | Preserve as collateral-benefit control for refactor reuse |
| Workspace scan, cold; three fresh sessions | 2691–2712 | 2830–2853 | Mean 2843.0; old/new difference is not attributable to code |
| Workspace scan, warm; three fresh sessions | 1240–1286 | 1322–1344 | Mean 1332.4; cache still leaves substantial work |
didOpen pinmux_reg_top.sv → definition; fresh sessions |
112 / 128–131 | 128.1–130.0 | §46's former 1.6-second open cost remains fixed |
didOpen spi_device.sv → definition; fresh sessions |
15.5 / 13.8–15.1 | 8.7–13.9 | Preserve the already optimized open path |
didChange tb.sv → folding barrier |
1.79 / 0.89–0.97 | 1.05 / 0.65–0.72 | Small-buffer flush is not the bottleneck |
didChange → diagnostics publication |
164.5 / 153.5–160.7 | 158.0 / 156.0–157.6 | About 150 ms is intentional debounce |
Unblocked definition on aes |
0.47 / 0.13–0.17 | 0.36 / 0.05–0.08 | Navigation itself is cheap |
| Unknown-method transport control | 0.63 / 0.09–0.32 | 0.24 / 0.066–0.070 | Cannot explain multi-millisecond or 300 ms blockers |
Idle RSS after workspace scan is 528.0–530.9 MiB cold and 566.4–573.8 MiB warm; allocated index-store size is 44.34 MiB (du -sk). These are consistent with take 4's general half-gigabyte resident footprint, not evidence of a new leak. The RSS phase is an idle ps observation, not a peak-memory measurement.
New attribution: code-action cost follows buffer size and work requested internally
The generated file is 1,328,188 bytes, below the default 4 MiB large-file threshold, so it takes the regular analysis path. These are repeated requests on its initial comment line; every row returns zero actions.
context.only |
Repeated latency | Interpretation |
|---|---|---|
| Unspecified: all families | 296.8–311.7 ms | Full no-offer cost |
[]: no families |
79.4–81.6 ms | Unconditional lint/fence/config work survives filtering |
quickfix |
79.7–80.1 ms | Essentially the same base cost |
refactor.extract |
134.6–136.2 ms | Base plus one text-based selector |
refactor.inline |
134.7–135.4 ms | Base plus one text-based selector |
refactor.rewrite.lucisv.ports |
134.0–135.5 ms | Base plus one text-based selector |
source.organizeImports |
133.6–135.8 ms | Base plus one text-based selector |
The source confirms five separate full-text parse entry points on this no-offer path: one in fence protection and one in each of four selectors. The filter experiment is consistent with an approximately 80 ms shared base plus roughly 55 ms per selector. It does not split that 80 ms between linting, fence parsing and configuration I/O. That split needs counters/profile data before further optimization.
Size controls, all no-offer comments: aes_core.sv repeats 9.6–11.7 ms; spi_device.sv 13.3–17.1 ms; the generated pinmux file 296.8–311.7 ms. This is not workspace fan-out: the cursor offers nothing. Unblocked definition on aes takes around 0.05–0.08 ms; pipelining it after the generated-file action takes 300.7–304.1 ms.
There is a second independent offer cost. At aes_reg_top u_reg in aes.sv, requesting only the ports family takes 21.6–21.8 ms and returns zero port actions, while the other family filters take roughly 0.6–1.2 ms including the common base. The lazy port path still builds plans on the buffer/declaration file and discards their edits. Reusing just the four selectors will not necessarily eliminate this cost; P1c covers it.
Paired CLI control: the Style difference is largely the new rule's path
hw/ip, identical input, default worker count, three independent invocations per cell. Values are first / range of trials 2–3 in seconds. Lint exit status is 1 in every row because findings exist.
| Configuration | 0.43.0 now | 0.49.0 now | 0.50.0 now | Findings |
|---|---|---|---|---|
Default check |
0.42 / 0.39–0.40 | 0.39 / 0.38–0.38 | 0.59 / 0.40–0.40 | 445 on all |
--select error,warning,style |
0.46 / 0.45–0.46 | 0.57 / 0.58–0.59 | 0.58 / 0.56–0.58 | 7734 old; 7751 at 0.49/0.50 |
Same selection, --ignore unused-import |
rule absent; not run | 0.45 / 0.45–0.48 | 0.44 / 0.44–0.47 | 7734 |
At 0.50.0 the all-style mean is 0.573 s, versus 0.450 s with only unused-import disabled: 123 ms, about 21.5% of all-style wall time. That includes both the rule and the package-census work it enables; it is not an isolated rule-body timer. It brings the current binary back near 0.43.0's all-style mean of 0.457 s. This is stronger evidence than inferring cost from the 17 additional findings. Default/all-style/ignored-rule stdout is byte-identical between current 0.49.0 and 0.50.0 controls. The first 0.50.0 default invocation is an outlier, not a basis for a regression claim.
Current all-style peak RSS is 208.4 MiB, versus 177.5 MiB with that rule disabled (maximum of three); treat this as a supporting control, not an allocation profile. Current formatter --check with an independently reset cache takes 0.67 / 0.59–0.68 s cold, 0.69 / 0.61–0.63 s warm. It reports 1772 would-reformat, 30 unchanged, four failures; warm runs hit only those 30 cached clean files. The cache cannot accelerate the many files requiring formatting. No proposed change should cache unverified output or remove runtime verification to improve this number.
Causes and implementation plan
Priorities below are recommendations for the implementation agent, not changes made by this analysis. Targets are provisional acceptance goals on this machine and corpus; they are not measured savings or CI timing assertions. Complete one stage, measure it, then decide whether its next stage is justified.
P0 — Make the performance evidence trustworthy
Cause. The committed harness is useful but some rows do not mean what their names imply. phases_new.py::phase_refactor sends codeAction/resolve for every action without an edit, including command-only extract/inline offers. Dispatch sends those to the ports resolver, which rejects offers without its data. Their tiny times do not measure extraction or inlining. Session.ms discards the response, so an error can look like a fast success. phase_rss puts idle RSS in a field called ms; it is neither latency nor peak memory. sweep.sh::run_cell deletes the format cache once before the three “cold” tries, making tries 2–3 warm.
Work. Preserve the existing historical raw rows. Add explicit units, request result/error status, client capability shape, exact result counts and normalized edit/warning fingerprints to new records. Route edit-bearing offers to resolve and command-bearing offers to a separate execute-command scenario. Capture the server's workspace/applyEdit payload as the edit-computation boundary without applying it to the corpus. Reply applied: false with a benchmark-capture reason; record that intentional client rejection separately from an engine refusal or computation error. Count created files, edits, refusals and warnings; do not benchmark an error as a successful operation. Distinguish scan completion from first-useful-answer latency and distinguish fresh processes from repeated requests. Reset only the dedicated scratch format cache before each cold try; explicitly prime warm rows.
Files and contracts. tools/perf/{bench.py,phases_new.py,lspclient.py,harness.py,sweep.sh,sweeptable.py,README.md}. Keep old log readers compatible or version the schema. No production change is needed. Preserve request framing and exact result validation. Record guard failures as failures.
Acceptance. A deliberately rejected request is recorded as an error. Inline/extract execution rows demonstrably observe a command and an apply-edit payload, or an expected refusal. Cold formatter rows have zero cache hits independently. RSS and peak RSS use separate fields with explicit units. Reproduce this analysis's baseline before interpreting a speedup.
P1 — Remove repeated work from code-action discovery
This is first because it is a frequent editor request, and the serial request loop passes its delay to navigation queued behind it.
Confirmed causes.
server/dispatch.rsconstructsLintRunand callscode_action::code_actionsbefore checking action-family filters.code_action.rs::code_actionscallslint::fixableunconditionally. Evencontext.only: []or a refactor-only request pays for lint and fence discovery.lint.rs::fixablereruns the selected lint rules and callsvlog_formatter::fence::protected_regions. That function parses the whole text again, even when there is no fix to protect.inline_site,extract_site,imported_packagesandport_action_moduleseach accept text and independently parse it. The server already holds text, tokens, tree, diagnostics and semantics from the same document revision.- The lazy ports offer invokes
port_actionson one or two source files and throws away its edits. It avoids workspace fan-out, but it still computes more than a menu needs. Import offers compute exact removal/sort counts using their engine. Treat these costs separately from the simple selectors.
P1a: skip irrelevant work. Before config discovery, lint execution and fence discovery, check whether quick fixes or source.fixAll.lucisv are wanted. Return immediately for an empty only filter. For requests that do want fixes, find whether any candidate carries an applicable fix before computing fence regions. Preserve kind-prefix semantics, fixes spanning the cursor, fix-all behavior and existing action ordering. An empty cursor range must not disable extraction: extraction currently supports an item selected by a cursor.
P1b: reuse unchanged-buffer work. Introduce additive refactor selectors over an existing parse plus its matching diagnostics; retain text-based wrappers for standalone consumers and parity tests. Have all offer families read Document's current parse. Check parse diagnostics and large-file mode exactly as the old paths do. If even AST walks are expensive on generated files, derive only the necessary item/instance/import interval lookup once per document revision; do not introduce a general incremental parser for this step.
For fences, first retain the existing text-only authority and memoize its result per document revision. This respects the explicit contract in docs/features/shared-fence-filter/README.md: accepting arbitrary caller trees was deliberately avoided. Compute it only if a fix needs it. A future parsed-input API requires an explicit amendment to that contract, source/tree provenance and parity with the text API on malformed buffers and every fence shape. Never substitute formatter collect alone: the scan backstop is part of protection.
Do not reuse published diagnostics blindly as fix results: tab_width, rule options, inline/external waivers and workspace-dependent lints affect the answer. If lint-result caching remains necessary after the first measurements, key it by document revision, effective lint/format settings, waiver contents and workspace generation; invalidate on each relevant change. Fence caching itself depends only on exact source revision.
P1c: offer predicates instead of throwaway edits. Only if ports/import offers still dominate, expose engine-owned availability/count queries using parsed inputs and the necessary declaration facts. Keep refusal logic in vlog_refactor; do not grow an independent server-side refactoring engine. Resolve/execute must revalidate against current document and workspace state. Preserve ambiguous declarations, refusal text and promised counts; do not promise exact counts that the reduced query cannot establish.
Files and contracts. Server: server/dispatch.rs, code_action.rs, lint.rs, state.rs, ports.rs, imports.rs, extract.rs, inline_module.rs. Engine: selectors in vlog_refactor/src/{ports/,imports.rs,extract/,inline/,lib.rs} as applicable. Formatter fence.rs only if explicitly needed. Follow topo.md §1.2's request-selector parity and §3's shared ownership. state.rs already exceeds the preferred size: put new responsibilities in a small module; coordinate with TODO §55 rather than adding another large subsystem there.
Validation and targets. Pin old/new offer equality at every sampled cursor/range, including no-offer comments, parse errors, CRLF, UTF-16 positions, unsaved edits, untitled and large buffers, action filters, fence insertions, waivers, config changes and index refresh. Verify “no additional parse for repeated offers” with work counters, not a brittle stopwatch assertion. Proposed timing goals: ordinary repeated lazy offers below 5 ms; the current slow aes_reg_top offer below 10 ms; no-offer generated-file cursor below 16 ms on an unchanged buffer. Track the first request after a change separately, and measure pipelined definition latency. If a goal is missed, identify the measured remaining stage before proceeding.
P2 — Reuse refactoring analysis while preserving whole-edit verification
Confirmed repeated work. rename.rs selects and materializes source strings. vlog_refactor::Scope::build builds an index from them, parsing/analyzing their text. Scope::analysis parses/analyzes the same input again on demand. check::rebuilt_index rebuilds an index over all selected sources after editing only a few, and check::verify parses/analyzes every watched file again, including untouched ones. Cross-file resolution genuinely must be checked again; unchanged syntax/local semantics need not be recomputed just to perform that check.
Selection hypothesis requiring measurement. state.rs::fan_out_of searches all matching workspace and hierarchical declarations for both old and new names, then includes their containers and instantiation/reference sites. A common internal name such as state_q can therefore select much more input than the two output files suggest. hierarchical_declarations scans the internal surface. The source confirms this behavior, but this round does not attribute percentages of rename time to selection, parsing, resolution or verification. Do not describe the entire 0.8 seconds as a slow hierarchical lookup.
P2a: measure stage and work counts. Record selector time; selected paths and total bytes; reason each path was included; ambiguity fallback; initial index build; number of parses/analyses; occurrence collection; before/after verification; serialization; peak memory. Compare state_q, unique internal names, common clk/rst_n, module aes, existing/conflicting new names, unresolved new-name uses and all-sources fallback. Capture the exact selected set so reduced work cannot masquerade as a faster correct answer.
P2b: one input analysis per file. Give a request-local scope a reusable parsed/semantic bundle from which it can derive FileFacts and analyze occurrences. Existing FileFacts::from_analysis is the starting point. Keep source text ownership and identity explicit. First eliminate duplicate work inside the scope; importing live server documents and index state is a separate step, because file IDs and the subset's name-resolution universe may differ. An additive prepared-input API must retain the current public text API and its answer/refusal behavior. Avoid a whole-workspace AST cache: current idle memory already warrants restraint.
P2c: reuse unchanged post-edit inputs. Construct the after-index from unchanged facts plus newly analyzed edited files. For untouched watched files, reuse local semantics and recompute their external resolutions against the after-index; for changed files, build one new parse/analysis and reuse it for after-facts and verification. Measure the clone/merge/remap cost: an incremental-looking API may still rebuild global tables. Preserve path-based identity and span-shift mapping when file IDs change. Token identity, parse-diagnostic checks, comments/attributes and before/after resolution comparison all remain mandatory.
P2d: narrow only with a proof. After reuse is measured, consider exact-name postings to avoid scanning unrelated declarations without changing the selected set. Further narrowing must preserve every edit, warning, ambiguous-use refusal, unresolved new-name capture and unsaved-buffer contribution. Compare the optimized scope with the whole-scope engine on generated/adversarial cases. Do not remove the all-sources fallback or common-name witnesses merely because they are expensive.
Files and contracts. lucisv_server/src/{rename.rs,state.rs}, vlog_refactor/src/{scope.rs,rename/,check/,lib.rs}, vlog_semantic/src/workspace/{record.rs,index.rs,update.rs,mod.rs} and actual merge owners as needed. Inspect current paths before assigning ownership. Preserve topo.md §1.2/§3's collect_occurrences, source-superset, FileId, FileFacts, ambiguity and name-span contracts. New persisted fields require a FACTS_FORMAT bump; a transient request bundle does not.
Correctness prerequisite. Topology open handshake 33 already records that module_sources can miss transitive hierarchical users such as wrap.u_S.x. It is specifically an inline/refactoring refusal gap, not proof that the measured rename has this bug. Resolve and test it before sharing a narrower source-selector implementation with inline/ports. Include multi-level hierarchy, generated scopes, interface/package/class names, macros, duplicate modules and unsaved references. Additional necessary files may increase time; report that as correctness work rather than hiding it.
Acceptance and targets. Identical normalized edits, warnings and refusal sentences to the original whole-scope engine on the parity suite; every valid edit still passes both verifiers. First target: at least 2× lower repeated tail-rename time and no ordinary-rename regression; stretch target below 200 ms only if stage measurements support it. Record selected/watched/edited file counts and bytes beside timing. The queued navigation target follows the same reduction. A faster partial edit is a failure.
P3 — Eliminate the extra CLI package-census parse
Cause. lucisv/src/lint.rs::Census::of calls vlog_linter::package_exports(path, src) for every job whenever unused-import is enabled. vlog_linter/src/interfaces.rs::package_exports constructs a one-file WorkspaceIndex, including lex/parse/analysis, even for files declaring no package. The census then separately constructs ParsedSource for interface rules; the actual lint pass later parses again. This is concrete duplicated whole-file work. Finding only a few extra violations does not imply that computing the rule should be cheap: all input files are examined.
Work. Add a package-export query over the census's existing parsed input, sharing semantic/fact extraction only where necessary. Use the parsed AST to skip package-index work for files without package declarations; never use a textual contains("package") correctness gate. Preserve duplicate/unknown package treatment, nested declarations, malformed source and the conservative handling of re-export chains. Keep the shared linter/refactor import-use judgment; do not implement a different import resolver in the CLI. Determine whether the census can share its parse with interface extraction before considering retention into the later lint phase. Retaining every project's AST may trade a small wall-time gain for unacceptable memory, so measure peak RSS at each step.
Files and contracts. crates/lucisv/src/lint.rs, crates/vlog_linter/src/{interfaces.rs,lib.rs}; semantic fact extraction only if needed, by an additive API. The CLI has no direct semantic production dependency; keep that topology. The same package uncertainty must produce the same lint silence, and lint findings/fixes/waivers/exit codes remain stable.
Acceptance and targets. Run default, all-style, and all-style minus unused-import on the same binary, then compare paired revisions with matching rules and files. Default results must remain byte-identical; all-style optimization must retain unused-import's findings. Aim to remove at least half the measured incremental all-style cost of this rule with no material default-time or peak-memory regression. Disabling the rule is only the attribution control, not the proposed optimization.
P4 — Reduce startup work and memory after interactive costs are addressed
Cause supported by source. A warm index still reads source text to hash it, decodes encoded facts, rebuilds/merges query tables, constructs completion/include tables and refreshes open-buffer overlays. IndexCache retains encoded facts alongside the decoded workspace records; cold scans encode/append records and whole-scan completion compacts the store. These explain why a warm cache is not a near-zero-cost startup; their individual time/memory shares are unmeasured. Current scan notes also show a 124-file default scan preceding the final configured scope; explicit depth 0 pays for it and then ends with one file.
Work order. Instrument discovery/config wait, file read/hash, fact decoding, merging, completion/include construction, overlay refresh, cache write/compaction, and time to first useful navigation answer. Use the existing ignored scan/prelude/publish probes where applicable. Measure 1/10/100 open buffers and requests arriving during a scan, not just final idle time. If the default scan is routinely discarded, stage the initial scan until configuration arrives, with a bounded fallback for clients that never answer; keep rootless and scope precedence behavior intact.
Then optimize the dominant measured stage: avoid unnecessary compaction on unchanged stores; shorten temporary source/encoded-buffer lifetimes; reduce redundant transient copies and repeated full merges; consider representation changes only after profiling shows allocation/decoding cost. Changes must preserve interrupted-store recovery and a coherent index/candidate/include prefix. Preserve content-based freshness checks rather than replacing them with mtime/size-only cache hits. Do not introduce mmap, compression, unsafe code, another dependency or parser worker parallelism without a separate measured case and contract review.
Files and contracts. server/index.rs, state.rs, index_cache.rs, candidates.rs, includes.rs, and semantic build/facts owners. This shares files/contracts with P1/P2. Preserve scope ladder, live overlays, incremental/fresh-build fingerprint equality, corrupt-store recovery, version rejection, FACTS_FORMAT compatibility and the 16 MiB parser stack on any new parsing thread.
Acceptance and targets. Suggested goals: warm workspace settled time below 1 second, cold below 2.3 seconds, and at least 15% lower idle RSS with equivalent indexed content. Measure peak RSS too. These are investigation goals, not simultaneous promised savings; reject memory-for-speed trades that are not recorded and justified. Definition during scan should remain responsive and never observe mismatched published tables. Recheck file-open latency so the already successful §46 fix stays intact.
P5 — Conditional follow-ups, not the first implementation
If first-after-edit latency remains outside the interactive budget after P1, remeasure Document::new and the ignored breaking_down_one_flushed_keystroke probe on 1k/10k generated files and actual large RTL. Distinguish parse time from the clone included in the existing parse measurement. The historical 79% lex/parse share is a lead to remeasure, not a current profile. A parser/token ownership change reaches six crates, comments/trivia consumers, exhaustive AST walkers and recursion guarantees in topo.md; it should not be bundled into an offer-gating patch.
If expensive user commands still block navigation after P2, separately design cancellable computation over immutable, revision-tagged workspace snapshots. Revalidate all document/workspace versions before returning edits; do not hold a workspace lock during heavy work. The synchronous transport, cancellation queue and stack-size contracts make this a larger architectural project. Measure queue delay before choosing it. Do not begin with an async runtime or thread-pool rewrite.
The eager-client path remains monitored because it is expensive, but previous owner guidance classified it as non-hot. Preserve eager compatibility and collect its timings as a collateral benefit of P2; do not trade lazy-client latency or correctness for it. Sub-millisecond navigation, the intentional 150 ms diagnostic debounce, and the fixed 0.50.0 format-cache option key are regression controls, not present optimization targets. Never remove formatter token-equivalence or convergence verification to improve throughput.
Sequencing, ownership and implementation gates
Implement serially: P0 → P1a → P1b → measure → P1c if needed → P2a → P2b/P2c → P2d only with proof → P3 → P4 if justified. P5 requires a new measured decision. P3 may be chosen ahead of P2 if CLI throughput is the product priority; it has a smaller implementation surface.
Do not dispatch the server/refactor/parser/semantic work as independent lanes. docs/topo.md records direct dependencies, shared state.rs ownership and the open transitive-use handshake; P1–P4 have several of these collisions. If work is later delegated, the lead must first name exact files/contracts and follow the repository's isolated-worktree/QA process. No agents or implementation work were dispatched by this analysis.
For each selected stage, create its feature README with Goal, Assumptions, Handshakes, Status/TODO, Work log, QA log and reserved Review. Update the tracking file with its baseline before edits, after measurements at the exact candidate commit, result parity, resource use and verdict. Do not mark an estimate as an improvement.
Run affected correctness suites per stage, then the repository's required format, clippy and workspace test gates at integration, plus formatter snapshot/idempotency and corpus checks when the changed contract reaches them. All suites/sweeps go through tools/guard.sh -m 8 -t 1800; no Cargo build or other benchmark runs during timed sessions. Keep the corpus read-only and retain exact failure/outcome sets, not only aggregate counts. Update docs/topo.md when an interface changes and docs/perf/README.md with accepted measured results. This analysis changes documentation and measurement evidence only; it does not mark implementation backlog items complete.
Source and contract references for the implementation agent
| Cause or boundary | Current source / documentation |
|---|---|
| Action dispatch before kind filters | dispatch.rs, CodeActionRequest branch; code_action.rs, code_actions |
| Repeated lint and fence parse | server lint.rs, fixable; fence.rs, protected_regions; shared-fence-filter contract |
| Four text-based selectors | inline/mod.rs, extract/mod.rs, imports.rs, ports/mod.rs |
| Lazy offers computing engine edits | server ports.rs, offers; server imports.rs, offers; engine imports.rs, organize_counts |
| Broad rename selection | state.rs, rename_sources / fan_out_of; workspace/index.rs, hierarchical_declarations |
| Rebuilt refactoring analysis | scope.rs, build / analysis; check/mod.rs, verify / rebuilt_index |
| CLI package census | CLI lint.rs, Census::of; linter interfaces.rs, package_exports |
| Warm-cache work | index_cache.rs; state.rs, scan preparation / scan_step / finish_whole_scan; server/index.rs |
| Shared ownership and handshake 33 | topo.md, §1.2, §2.9 and §3; repository analysis |
| Previous data and measurement methods | performance_take4.md, performance_take3.md, perf README, harness README |