From 8145a67be67f348ad13eaa35ddf1ca74b9ec097c Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Sat, 5 Sep 2026 08:15:37 -0500 Subject: [PATCH] The didOpen delay: undriven-net asks the workspace census last, not once per declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- TODO.md | 101 +++- crates/lucisv_server/tests/e2e.rs | 204 +++++++ crates/vlog_linter/src/rules/undriven_net.rs | 71 ++- docs/features/didopen-cost/README.md | 565 +++++++++++++++++++ docs/perf/README.md | 31 + docs/performance_take3.md | 18 + 6 files changed, 972 insertions(+), 18 deletions(-) create mode 100644 docs/features/didopen-cost/README.md diff --git a/TODO.md b/TODO.md index 6aa95a0..486f75c 100644 --- a/TODO.md +++ b/TODO.md @@ -4563,12 +4563,20 @@ since 0.39.0. Two findings are real work and wait for the owner's call: the server needs building per tag) and fix the regression, or rule that non-resolving clients are not a hot path (VS Code, Neovim's built-in client and Helix all resolve). -- [ ] **A `didOpen` of a file already in scope delays the next request by +- [x] **A `didOpen` of a file already in scope delays the next request by 21–51 ms**, scaling with file size (take 2: 2–4 ms). The open, not the request. Find what the open now does synchronously that it did not (the §33+ diagnostics pass? the §37 lint run construction?) and move it off the request path or measure it as the price of the - diagnostics the file gets. + diagnostics the file gets. — done by §46 (0.44.0), and it was + neither: the lint pass is 75–95 % of the open and the rule + `undriven-net` is 90–97 % of the lint pass, because it asked the + workspace census once per declaration in the buffer before its own + local guards could silence it. Asked last now, as its twin rule + `unused-signal` always has. 51/70/95 → 4.6/7.3/7.8 ms on the three + files of take 3 §8.4; 1 742 → 117 ms on opentitan's 42 192-line + `pinmux_reg_top.sv`. Not a regression — 0.39.0 measures the same. + `docs/features/didopen-cost/README.md`. - Noted, not actioned: `lucisv check` 6–10 % slower than 0.39.0 on `hw/ip` (73 rules vs 54; per-rule cost flat), `workspace/symbol` drifting 6.6 → 7.9 ms over three takes, `rename` 115 → 152 ms with two @@ -4704,9 +4712,86 @@ request waits for. open of an edited-on-disk file sees the buffer's text; the take-3 rows re-measured in the README. -- [ ] measurement + profile, in the README -- [ ] the fix, with the ≤ 5 ms return contract pinned -- [ ] docs; §44b ticked; take-3 finding 2 annotated -- [ ] Gates (guarded); the take-3 rows re-measured -- [ ] QA: the driver re-run on the three files at three sizes; the - diagnostics still arrive; no request answered from stale state +- [x] measurement + profile, in the README — and the finding understated it: + `pinmux_reg_top.sv` (42 192 lines) delayed the next request by **1 742 + ms**, of which 1 608 was the one rule `undriven-net` asking the + workspace census once per declaration ahead of its own local guards +- [x] the fix, with the ≤ 5 ms return contract pinned — the census question + moved behind the guards, where `unused-signal` has always asked. Met + for a generated 1 000-line buffer (<2 ms); 5.9–6.9 ms for + `aes_core.sv`, 1 145 lines of dense RTL whose 3.0–4.4 ms of parse + cannot be deferred without answering the next request from stale + state. Recorded as the limit in the README, not redefined +- [x] docs; §44b ticked; take-3 finding 2 annotated — the annotation text and + a `docs/perf/README.md` entry are in the feature README under "Docs to + apply at merge (lead)" +- [x] Gates (guarded); the take-3 rows re-measured — 3 814 tests (was 3 810), + corpus 814/820 same six, clippy and fmt clean, smoke OK; §8.4's three + files 51/70/95 ms → 4.6/7.3/7.8 ms +- [x] QA: the driver re-run on the three files at three sizes; the + diagnostics still arrive; no request answered from stale state — + PASS, independently re-derived on a new driver: 0.43.0 vs fixed + 3.4×/11×/17× on aes.sv/aes_core.sv/pinmux_reg_top.sv; opentitan + `hw/ip/{aes,hmac,spi_device}` and + `hw/top_darjeeling/ip_autogen/pinmux` byte-identical; counting-oracle + test confirmed to fail on a hand-reverted scratch copy; gates + reproduced (3814/0/44, corpus 814/820, clippy/smoke clean); QA log + in `docs/features/didopen-cost/README.md` + +## 47. Type-name spans on the AST; retire `vlog_semantic/src/scan.rs` (planned 2026-09-05) — topo §2.9-2 + +One lane after 0.44.0, §36's protocol. Feature README: +`docs/features/type-name-spans/README.md`. Ships in 0.45.0 with §48/§49. + +`vlog_semantic/src/scan.rs` (193 lines) recovers the byte range of a name +the AST kept only as a `String` by scanning the construct's source text. +Its two remaining users, both in `bind/`: `bind/decl.rs` (the type name of +a declaration — `DataType::name`, split as `pkg::item` into unit and item +spans by `NameScanner`, or as `iface.modport` into head and tail) and +`bind/stmt.rs` (`disable