The didOpen delay: undriven-net asks the workspace census last, not once per declaration

TODO §46 (docs/features/didopen-cost). Closes take-3 finding §8.4 (§44b).

Measured first: on opentitan the open of a 42 192-line file cost
1 745 ms, of which the lint pass was 1 654 ms and `undriven-net` alone
1 608 ms — the rule asked `WorkspaceIndex::files_mentioning` (a walk over
all 3 976 indexed files) once per declaration, ahead of the local guards
that silence almost all of them. Six lines reordered so the oracle is
asked last, as `unused-signal` always did: same findings, same order
(pinned by a counting-oracle unit test that fails on a revert, and shown
byte-identical against 0.43.0 over a crafted workspace and four opentitan
IPs). didOpen → next request: 1 742 → 117 ms on the largest file,
51–95 → 5–8 ms on typical IPs, the same on every keystroke flush. No
debounce added; three wire-level pins with a debug-build bound.

Docs: take-3 §8.4 annotated, docs/perf/README.md entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-05 08:15:37 -05:00
1 parent f7956060b3
commit 8145a67be6
6 files changed
+972 -18

No files matched your search

+18
View File
@@ -640,6 +640,24 @@ delays the next request by 51 ms, three frames.
**Reproduce.** `bench.py widen default`, warm store; `didOpen spi_device.sv`
then immediately `textDocument/definition` at the first `module ` token.
**Fixed in 0.44.0 (TODO §46), and the finding understated it.** The delay is
not the widen, the diagnostics plumbing or §42's lint-run construction: it is
one rule. `undriven-net` asked the workspace census
(`WorkspaceIndex::files_mentioning`, a walk over every indexed file) once per
declaration in the buffer, *before* its own local guards had a chance to
silence it — so a file with four thousand declarations asked four thousand
questions and threw away four thousand answers. `unused-signal`, the twin
rule with the same oracle, has always asked last; `undriven-net` now does
too. At the whole-workspace scope, where the census covers 3 976 files rather
than this section's ~124, the same three files measured 51 / 70 / 95 ms
before and **4.6 / 7.3 / 7.8 ms** after, and opentitan's largest file,
`hw/top_darjeeling/ip_autogen/pinmux/rtl/pinmux_reg_top.sv` (42 192 lines),
went from **1 742 ms to 117 ms** (QA re-derived 1 805–1 825 → 104–108). The
take-2 comparison in this section should be read as "take 2's session
probably did not have the workspace rules on", not as a regression: 0.39.0
measures the same as 0.43.0 on every cell. Breakdown and method in
`docs/features/didopen-cost/README.md`.
### 8.5 FINDING (low) — `lucisv check` is 6–10% slower than 0.39.0
`hw/ip`: 0.367 → 0.400 s mean of three (default rules), 0.420 → 0.463 s