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

+31
View File
@@ -1078,3 +1078,34 @@ for one keystroke in a 10 000-line buffer, roughly 30 ms of it lex and parse.
That is the figure any incremental-parsing proposal has to be argued against,
and it now exists.
### 2026-09-05 — the `didOpen` delay (TODO §46, 0.44.0)
Take 3's §8.4 (a `didOpen` of an already-indexed file delaying the next
request by 21–51 ms) measured and fixed. The breakdown, taken with temporary
timings on a release build and re-taken after: the tolerant parse plus the
semantic analysis is 1.3 / 3.0 / 91 ms for a 326- / 1 145- / 42 192-line
opentitan file, and the lint pass was 4.9 / 54 / 1 654 ms — of which
`undriven-net` alone was 4.4 / 52 / 1 608. 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.
Moved behind them, where `unused-signal` has always asked.
Wire time, `didOpen` → the request behind it, workspace scope, warm store,
three tries, M1 Max:
| file | before | after |
|---|---|---|
| `aes.sv` (326 L) | 8.1 / 5.9 / 10.1 ms | 4.3 / 1.8 / 2.3 ms |
| `aes_core.sv` (1 145 L) | 56.2 / 54.0 / 48.0 ms | 5.9 / 6.9 / 6.3 ms |
| `hmac.sv` | 56.8 / 42.7 / 51.0 ms | 4.7 / 5.7 / 3.3 ms |
| `kmac.sv` | 69.3 / 72.1 / 70.6 ms | 7.9 / 5.3 / 8.8 ms |
| `spi_device.sv` | 94.2 / 103.4 / 88.6 ms | 6.0 / 8.6 / 8.7 ms |
| `pinmux_reg_top.sv` (42 192 L) | 1 742 / 1 740 / 1 757 ms | 116.5 / 116.2 / 117.3 ms |
The same cost was paid on **every keystroke flush**, not just on opens: the
change debounce ends in the same `set_document` + `publish` pair. 0.39.0
measures the same as 0.43.0 everywhere in the "before" column, so this was
never a regression — the rule had been ordered that way since it was
written. Published diagnostics are byte-identical before and after. Full
account: `docs/features/didopen-cost/README.md`.