Files
lucisv/docs/performance_take3.md
lucioandClaude Fable 5.1 8145a67be6 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]>
2026-09-05 08:15:37 -05:00

786 lines
49 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# lucisv performance against opentitan — take 3
Same corpus, same scenarios, same machine as
[`performance.md`](performance.md) (take 1) and
[`performance_take2.md`](performance_take2.md) (take 2); two new binaries and
one new question. Take 2 measured `ee1efe3` — the merged performance wave.
Take 3 measures **0.43.0 (`73799f3`)** against **0.39.0 (`0757503`)**, and
every table carries take 2's number beside them so each row is a before/after.
This round also covers the **CLI** for the first time: `format --check` and
`check` over five opentitan trees, three binaries, wall clock and peak RSS.
Every LSP number is a client-observed round trip on a monotonic clock
(`time.perf_counter`) — what the editor, and therefore the user, actually
experiences. Read §9 before quoting any of them.
---
## 0. Read this first — take 3 *does* have a server-side column
Take 1 and take 2 both opened with "no server-side instrumentation": their
binaries carried no timing literals, so every number was a client round trip
against a transport floor.
**That is no longer true, and it is an improvement, not a contamination.** The
shipped server has a `--verbose` flag (`docs/features/verbose-timing/`) that
logs `timing: <method> answered in <n> ms` per request over
`window/logMessage`. It is present in 0.39.0 and in 0.43.0 and absent from
take 2's binary. Nothing was added for this round: the default (no `--verbose`)
sessions produce every number in this document, and one supplementary session
per shape was re-run *with* `--verbose` to check the wire against the server's
own clock.
| `codeAction` at the cursor | wire, no `--verbose` | wire, `--verbose` session | server's own line |
|---|---:|---:|---:|
| `prim_flop_2sync` (128), eager | 270.2 / 252.9–255.2 ms | 252.5 / 244.8–254.6 ms | 252.28 / 244.55–254.46 ms |
| `prim_flop_2sync` (128), lazy | 24.0 / 15.6–16.9 ms | 22.4 / 13.4–14.6 ms | 22.04 / 13.21–14.41 ms |
| `aes` (6), eager | 66.1 / 45.7–48.2 ms | 64.6 / 47.0–47.8 ms | 64.26 / 46.78–47.66 ms |
| comment line | 1.8 / 0.7–0.8 ms | 1.7 / 0.7–0.8 ms | 1.30 / 0.58–0.68 ms |
**The wire is the server plus 0.2–0.4 ms, everywhere.** Take 1's and take 2's
central assumption — `client round trip ≈ server handling + ~0.05 ms` — is now
measured rather than assumed, and it holds with a slightly fatter floor
(0.2–0.4 ms rather than 0.05 ms, this harness being a Python client rather
than take 2's).
The transport baseline (an unknown method, `$/lucisvNoSuchMethod`, rejected
without work) is correspondingly higher in take 3:
| | take 1 | take 2 | take 3, 0.43.0 | take 3, 0.39.0 |
|---|---:|---:|---:|---:|
| transport baseline, first in a settled session | 0.02 ms | 0.019 ms | 0.24 ms | 0.31 ms |
| transport baseline, repeats | ≈0.05 ms | ≈0.05 ms | 0.059–0.092 ms | 0.057–0.064 ms |
**So every sub-millisecond row in take 3 sits on a ~0.06 ms floor rather than
take 2's ~0.02 ms, and roughly 0.04 ms of every such row's "slowdown" against
take 2 is this harness.** No conclusion is drawn below from any individual
sub-0.3 ms movement.
---
## 1. Environment and provenance
| | take 2 | take 3 |
|---|---|---|
| Machine | Apple M1 Max, 10 cores, 64 GB | **same machine** |
| OS | macOS 27.0 (26A5421a) | macOS 27.0 (**26A5425a**) |
| Date | 2026-08-29 ~00:45–02:00 | **2026-09-05 ~02:45–04:00** |
| Server under test | `ee1efe3`, 4 155 456 B, sha256 `a45d814c…` | **0.43.0 `73799f3`, 5 676 528 B, sha256 `0da08f40…`**, Mach-O arm64 |
| Baseline server | take 1's `bf9170a`+ | **0.39.0 `0757503`, 5 517 936 B, sha256 `58f7044e…`** — built for this round in a scratch `git worktree` at `v0.39.0`, `cargo build --release -p lucisv_server`, removed afterwards |
| CLI binaries | *not measured* | 0.43.0 `target/release/lucisv` (2 828 576 B, `89379a12…`), 0.41.0 (`5be28f2c…`) and 0.39.0 (`4caf841f…`) from `~/.cache/lucisv-baselines/` |
| Corpus | `/Users/guoliangchen/repo/opentitan` @ `0098135264` | **same commit**, 3976 indexed + 3 skipped — but see the one corpus difference below |
| Scenario file | `hw/ip/aes/dv/tb/tb.sv`; `aes` at 0-based 44:2 | same file, same position, resolved from the text at run time |
| Client | `scratchpad/perf2/*.py` (no longer on disk) | **a new client, `scratchpad/perf3/{lspclient,bench}.py`** — same shape, written from take 2's §1 description |
| Guard | — | **every server, `lucisv` and `cargo` run went through `tools/guard.sh -m 8 -t 1800`. No guard kill occurred.** |
### 1a. The one corpus difference, and it matters for two columns
`hw/ip/aes/dv/tb/tb.sv` is still modified in the checkout, but **the
modification is no longer the trailing-space edit take 2 measured against — the
file has since been reformatted by lucisv**, and is now lucisv-clean. Two
consequences, both of which make take-3 columns *not* comparable to take 2's:
- `textDocument/diagnostic` (pull) returns **0 items** at every scope in take 3,
where take 2 quoted "one `no-trailing-whitespace` item".
- `textDocument/codeAction` on the `aes` instantiation and on a comment line
returns **0 actions** in take 3, where take 2 recorded 1 at each. That one
action was the `source.fixAll.lucisv` quick fix the trailing-space diagnostic
raised; with no diagnostic there is nothing to fix. The *timings* are
unaffected — the cost is the port-refactoring fan-out, not the quick fix
(§6a proves this: the numbers track the fan-out, and the comment-line row is
0.7 ms in both takes).
The other two modified files (`hw/top_{darjeeling,earlgrey}/ip/ast/rtl/ast.sv`)
are unchanged from take 2 and are not in any scenario.
### 1b. The client, and what it does differently
The take-2 scripts were gone from the scratchpad, so take 3's client was
rewritten from take 2's §1 description. It is the same shape: framed
JSON-RPC over the server's stdio, `workspace/configuration` answered with a
per-session scope word, cache warmth controlled through
`initializationOptions.storagePath` (take 2's methodology fix, kept), positions
resolved from the file text at run time, every request timed from send to
response. Three deliberate differences:
1. **Client capabilities are settable per session.** A "VS Code-style" session
advertises `textDocument.codeAction.resolveSupport.properties: ["edit"]`
and gets §37.1's lazy offer; a session without it gets the eager shape.
Both are measured everywhere `codeAction` appears.
2. **A `--verbose` variant** of the codeAction sessions (§0).
3. **`.clk_i` is the one in the `aes` port list, 0-based 45:5.** Take 2's §1
says "line 49", which is `.output_valid_o()` in this file; the first
`.clk_i` in the file is on 0-based line 34, in a different instantiation.
Take 3 states its position rather than inheriting an ambiguous one, so the
two `references`-on-`.clk_i` rows below compare cost, not result sets.
---
## 2. Summary table — worst first, take 2 → take 3
Workspace scope, warm cache, unless the row says otherwise. "Repeats" is the
range over the 2nd–4th identical request in the same session; the "first" column
is that request issued as the first real request of a dedicated session.
| Action | T2 first | T2 repeats | **0.43.0 first** | **0.43.0 repeats** | 0.39.0 first | 0.39.0 repeats |
|---|---:|---:|---:|---:|---:|---:|
| Workspace scan, **cold** cache (didOpen → 3976 indexed) | 2 958 ms | 2 919 – 2 955 | **2 867 ms** | 2 754 – 2 773 | 2 764 ms | 2 752 – 2 756 |
| `textDocument/codeAction`, `prim_flop_2sync` (fan-out 128), **client without `resolveSupport`** | 200.7 ms | 184.9 – 186.2 | **270.2 ms** | 252.9 – 255.2 | 267.5 ms | 230.7 – 246.4 |
| `textDocument/rename` on `aes` (edits computed, not applied) | 115 ms | 107 – 121 (7 files) | **151.8 ms** | 139.1 – 140.7 (**9 files**) | 147.4 ms | 137.4 – 139.1 (9 files) |
| — anything queued behind that rename | 108 ms | — | **160.8 ms** | — | 162.0 ms | — |
| `textDocument/codeAction`, `prim_alert_sender` (67), no `resolveSupport` | 163.6 ms | 138.8 – 139.8 | **213.4 ms** | 196.0 – 196.5 | 210.3 ms | 191.7 – 194.6 |
| `textDocument/codeAction`, `prim_lc_sync` (42), no `resolveSupport` | 123.5 ms | 94.4 – 95.3 | **148.0 ms** | 128.9 – 130.4 | 137.7 ms | 125.4 – 126.8 |
| `codeAction/resolve` at the one cursor that offers an action (`aes_wrap.sv`, 6) | — | — | **119.5 ms** | 119.5 – 121.9 | *n/a* — no resolve at 0.39.0 | |
| Workspace scan, **warm** cache | 1 476 ms | 1 495 – 1 558 | **1 229.8 ms** | 1 220.5 – 1 229.7 | 1 227.9 ms | 1 218.1 – 1 225.1 |
| First `didOpen` of an RTL file **at the default scope** (`aes.sv`, widens to `hw/ip`) | 1 731 ms cold | 1 411 – 1 568 warm | **1 081.6 ms cold** | **365.1 ms warm** | 1 078.6 cold | 355.5 warm |
| diagnostics **publish** after a `didChange` (new row; ~150 ms of it is the debounce) | — | — | **161.1 ms** | 159.6 – 163.4 | 153.4 ms | 153.2 – 160.9 |
| `textDocument/codeAction`, `prim_flop_2sync` (128), **client with `resolveSupport`** (the lazy offer) | *n/a* | | **24.0 ms** | **15.6 – 16.9** | *n/a* — no lazy offer before 0.41.0 | |
| `codeAction` offer at the `aes_wrap.sv` cursor, lazy | — | — | **33.3 ms** | 21.2 – 26.8 | 119.7 ms (eager) | 117.4 – 119.3 |
| `codeAction` **on the `aes` instantiation**, lazy | 39.2 ms | 36.4 – 37.6 | **5.15 ms** | **4.05 – 4.24** | 59.7 ms (eager) | 45.8 – 46.1 |
| — definition pipelined behind that codeAction | 37.7 ms | 37.2 | **5.15 ms** | — | 59.7 ms | — |
| `codeAction`, `aes_reg_top` (fan-out 1), lazy | 19.8 ms | 13.2 – 17.4 | **27.1 ms** | 16.4 – 20.6 | 16.9 ms *(eager)* | 13.2 – 14.3 |
| `workspace/symbol "aes"` (256 results) | 6.6 ms | 6.6 – 7.4 | **8.8 ms** | 7.2 – 7.9 | 9.0 ms | 8.4 – 8.7 |
| — anything queued behind it | 6.9 ms | — | 11.0 ms | — | 11.9 ms | — |
| `textDocument/completion` at 0 typed characters (512 items) | 14.8 – 18.6 ms | — | **9.5 ms** | **2.3 – 2.8** | 5.2 ms | 3.0 – 3.3 |
| `textDocument/completion` at 1 typed character | 15.3 ms | 14.2 – 19.4 | **3.2 ms** | **2.5 – 2.7** | 3.8 ms | 3.0 – 3.1 |
| `textDocument/completion` at `aes_reg` | 0.59 ms (20 items) | 0.36 – 0.63 | **3.8 ms (512 items)** | 2.9 – 3.0 | 3.9 ms (512) | 2.6 – 2.9 |
| `codeAction` on a **comment line** (contrast) | 0.70 ms | 0.47 – 0.49 | 1.69 ms | 0.66 – 0.81 | 4.50 ms | 0.56 – 0.87 |
| `textDocument/references` on `aes` | 0.66 ms (7 hits) | 0.38 – 0.43 | **0.85 ms (14 hits)** | 0.54 – 0.61 | 0.92 ms (14) | 0.55 – 0.58 |
| `textDocument/signatureHelp` inside the port list | 0.57 ms | 0.44 – 0.58 | 0.70 ms | 0.57 – 0.62 | 0.67 ms | 0.64 – 0.74 |
| `textDocument/references` on `.clk_i` | 0.62 ms (10 hits) | 0.48 – 0.55 | 0.56 ms (12 hits) | 0.51 – 0.72 | 0.55 ms (12) | 0.61 – 0.65 |
| `didChange` flush (measured with a `foldingRange` barrier) | 0.48 ms | 0.33 – 0.45 | 0.95 ms | 0.58 – 0.80 | 0.77 ms | 0.60 – 0.91 |
| `textDocument/inlayHint` (whole file, 4 hints) | 0.38 ms | 0.23 – 0.34 | 0.49 ms | 0.26 – 0.43 | 0.45 ms | 0.25 – 0.27 |
| `textDocument/prepareRename` on `aes` (pressing F2) | 0.07 ms | 0.05 – 0.09 | 0.31 ms | 0.08 – 0.16 | 0.18 ms | 0.07 – 0.08 |
| — anything queued behind that prepareRename | 0.1 ms | — | 0.37 ms | — | 0.50 ms | — |
| `textDocument/diagnostic` (pull, 0 items — §1a) | 0.11 ms | 0.06 | 0.34 ms | 0.17 – 0.19 | 0.31 ms | 0.16 – 0.20 |
| `textDocument/definition` on `aes` | 0.27 ms | 0.05 – 0.11 | **0.19 ms** | 0.07 – 0.09 | 0.41 ms | 0.06 – 0.08 |
| `textDocument/semanticTokens/full` (251 tokens) | 0.16 ms | 0.14 – 0.16 | 0.21 ms | 0.19 – 0.25 | 0.21 ms | 0.16 – 0.19 |
| `textDocument/hover` on `aes` | 0.13 ms | 0.08 – 0.13 | 0.18 ms | 0.06 – 0.08 | 0.13 ms | 0.05 – 0.08 |
| `textDocument/documentSymbol` | 0.16 ms | 0.11 – 0.48 | 0.18 ms | 0.12 – 0.15 | 0.18 ms | 0.12 – 0.13 |
| `textDocument/foldingRange` | 0.05 ms | 0.04 – 0.08 | 0.10 ms | 0.05 – 0.07 | 0.05 ms | 0.05 – 0.06 |
| `textDocument/selectionRange` | 0.08 ms | 0.04 – 0.05 | 0.09 ms | 0.05 | 0.09 ms | 0.05 |
| `textDocument/documentHighlight` (1 result) | 0.04 ms | 0.04 – 0.07 | 0.10 ms | 0.04 – 0.05 | 0.05 ms | 0.04 – 0.05 |
| `textDocument/codeLens` | 0.05 ms | 0.04 – 0.06 | 0.07 ms | 0.04 – 0.05 | 0.06 ms | 0.04 |
| `textDocument/typeDefinition` on `aes` | 0.07 ms | 0.05 – 0.06 | 0.06 ms | 0.05 – 0.06 | 0.08 ms | 0.05 – 0.07 |
| `textDocument/documentLink` | 0.09 ms | 0.05 – 0.07 | 0.06 ms | 0.04 – 0.05 | 0.05 ms | 0.04 – 0.05 |
| `initialize` → response | 2.1 – 8.9 ms | — | 2.3 – 4.4 ms | — | 2.1 – 4.9 ms | — |
| *transport baseline (does no work)* | *0.019 – 0.14 ms* | — | *0.06 – 0.24 ms* | — | *0.06 – 0.31 ms* | — |
**The one-line reading of that table:** 0.43.0 and 0.39.0 are the same server
on almost every row. The single structural difference between them is
`codeAction` for a client that can resolve — §37.1 — and it is worth **11.8×**
on the hot path (59.7 → 5.15 ms at the `aes` cursor, 246 → 16 ms at a 128-file
fan-out). Everything else that moved since take 2 moved *before* 0.39.0, and
some of it moved the wrong way (§8).
---
## 3. The queue-blocking analysis — `codeAction` finally leaves the list
The server still runs a single-threaded request loop, so the latency a user
feels for request *R* is *R*'s cost plus everything queued ahead of it. Each
slow request was sent, then — back to back, no wait — the three requests a real
editor fires on every cursor move.
| Sent first (the blocker) | Its own cost, T2 | **0.43.0** | 0.39.0 | `definition` behind it, T2 | **0.43.0** | 0.39.0 |
|---|---:|---:|---:|---:|---:|---:|
| `codeAction` on the `aes` token | 37.4 ms | **5.07 ms** | 59.6 ms | 37.4 ms | **5.15 ms** | 59.7 ms |
| `prepareRename` on `aes` | 0.1 ms | 0.34 ms | 0.35 ms | 0.1 ms | 0.37 ms | 0.50 ms |
| `rename` on `aes` | 107.7 ms | 160.8 ms | 162.0 ms | 107.7 ms | 160.8 ms | 162.1 ms |
| `workspace/symbol "aes"` | 6.9 ms | 11.0 ms | 11.9 ms | 7.0 ms | 11.1 ms | 12.0 ms |
`hover` and `documentSymbol` behind each leader land 0.05–0.5 ms after the
definition, as in both earlier takes: the queue is still strictly serial and
the follower still pays the leader's bill almost exactly.
Take 1 and take 2 both named `codeAction` as the worst thing on the hot path —
take 2 called it "the single worst thing" and asked for memoisation or an
index-only answer. §37.1 did the second of those for the *offer*, and the row
is now 5 ms: **under the 16 ms frame budget, on a request that fires on every
cursor move.** Take 2's two structural conclusions survive with one amendment:
1. The absolute number still matters more than the ratio.
2. `codeAction` and `completion` were "the only slow requests on the hot path".
Both are now inside the frame budget for a modern client (5 ms and 2–3 ms).
**The hot path is clean.** What is left slow is user-initiated
(`rename`, 160 ms), once-per-session (the scan, 1.2–2.9 s), or paid only by
a client that cannot resolve a code action (§6a).
---
## 4. Startup and scan, per scope config and cache state
Methodology unchanged: `didOpen tb.sv` → the last `$/progress` `end`, followed
by 1.5 s of silence, three runs per cell. "Cold" = the `storagePath` directory
was `rm -rf`'d immediately before; "warm" = it carries a previous session's
store.
| Scope config | Cache | T2 didOpen → settled | **0.43.0** | 0.39.0 | files |
|---|---|---:|---:|---:|---|
| **default** (`[{}]` — no opinion at all) | cold | 94.0 ms | **81.9 / 92.5 / 93.1 ms** | 94.6 / 94.6 / 87.0 ms | 124 |
| **default** | warm | 51.2 – 58.6 ms | **39.4 / 40.3 / 41.8 ms** | 31.7 / 35.8 / 40.2 ms | 124, 123 from cache |
| `{"index":{}}` (the "empty" reply) | cold | 94.6 – 100.0 ms | **88.8 / 90.1 / 94.5 ms** | 91.1 / 92.1 / 92.4 ms | 124 |
| `{"index":{}}` | warm | *n/a* | **34.7 / 39.1 / 39.3 ms** | 37.9 / 38.0 / 40.2 ms | 124 |
| explicit `scopeDepth: 0` | cold | 98.9 ms | **93.5 / 101.6 / 105.5 ms** | 98.7 / 103.2 / 104.6 ms | 1 (after a ~90 ms 124-file scan is thrown away) |
| explicit `scopeDepth: 0` | warm | 55.0 ms | **42.3 / 49.3 / 49.6 ms** | 41.6 / 47.1 / 50.5 ms | 1 |
| `workspace` | cold | 2 918 – 2 958 ms | **2 754 / 2 773 / 2 867 ms** | 2 752 / 2 756 / 2 764 ms | 3976, 3 skipped |
| `workspace` | warm | 1 476 – 1 558 ms (+ outliers to 3 073) | **1 220.5 / 1 229.7 / 1 229.8 ms** | 1 218.1 / 1 225.1 / 1 227.9 ms | 3975 from cache |
- `initialize` is still 2–5 ms and still does no scanning. (One 231 ms outlier,
on the first server process this session ever spawned — a cold `exec`, not a
measurement of anything.)
- **The 0.39.0 column is why this table needed a baseline.** The warm workspace
scan reads 1 476 ms in take 2 and 1 220 ms tonight — a 1.21× "improvement"
that is *entirely* machine and page cache, because 0.39.0 measures 1 228 ms
on the same night. No code change is responsible; take 2's own §9 warned
about exactly this and said to quote the band, not the number. **Take 3's
band for the warm workspace scan is 1 218 – 1 230 ms, and it is much tighter
than take 2's** (12 ms spread across six runs and two binaries, against take
2's 1 476–3 073) because tonight's machine was quieter.
- **Persistence buys ~57%** on the workspace scan (2 800 → 1 225 ms) and ~57%
on the default scope (90 → 39 ms). Take 2 measured 48% / 44%.
- **A cold workspace scan is not fully cold**, and this is a shape both earlier
takes had without recording it: the pulled `scope: "workspace"` arrives after
the default-scope scan is already in flight, so the trace is `0 files → 124
files (83–92 ms) → 3976 files`, and the workspace bar reports "123 from
cache" even on a wiped store — those 123 are the default scan's own writes,
read back seconds later. It costs 83–92 ms of the workspace total.
- Both binaries emit ~1 100 `$/progress` reports and ~4 100 `indexing:` log
lines on a cold workspace scan, as take 2 recorded.
### 4b. What each scope answers, at 0.43.0
Take 2's §4b table, re-taken. The `aes` instantiation in `tb.sv`:
| Request | default | explicit `scopeDepth 0` | workspace |
|---|---|---|---|
| `definition` | **1 result**, 0.18 ms | 0 results, 0.15 ms | 1 result, 0.19 ms |
| `typeDefinition` | 1 result | 0 results | 1 result |
| `hover` | 1 result | 0 results | 1 result |
| `references` | **11 results**, 0.44 ms | 0 results | **14 results**, 0.85 ms |
| `documentHighlight` | 1 result | 0 results | 1 result |
| `signatureHelp` | 1 signature, 0.83 ms | 0 results | 1 signature, 0.70 ms |
| `workspace/symbol "aes"` | 256, 3.0 ms | 0 results, 0.04 ms | 256, 8.8 ms |
| `completion` at a fresh line | 512 items, 3.3 ms | 276 items, 2.0 ms | 512 items, 3.3 ms |
| `inlayHint` (whole file) | **0** | 0 | **4** |
Everything take 2 found here still holds, and two counts grew: `references` at
workspace scope is 14 rather than take 2's 7, and at the default scope 11
rather than 4. 0.39.0 returns the same 14 and 11, so the growth predates it;
it costs 0.85 ms against take 2's 0.66 ms for half the results, which is the
right direction.
**`inlayHint` still returns 0 at the default scope and 4 at workspace, and
§37.2 ruled that correct.** The four hints `tb.sv` can carry come from
`pins_if` instantiations; `pins_if` is declared in
`hw/dv/sv/common_ifs/pins_if.sv`, which is nowhere under `hw/ip/aes` — the
default scope's root for this buffer. At that scope `definition`, `hover` and
`signatureHelp` answer nothing about `pins_if` either, so inlay is not missing
a lookup its neighbours have: the zero is a scope-reach result, not an
inlay-hint defect. Take 2's §8 item 9 ("a correctness gap") is **closed as
investigated, not as a bug**.
---
## 5. The `didOpen` widen
### 5a. At `scopeDepth 0` — apples to apples with take 1 and take 2
`tb.sv` open, then RTL files opened one at a time; the request sent immediately
afterwards waits for the widen.
| Widening `didOpen` | T2 cold | T2 warm | **0.43.0 cold** | **0.43.0 warm** | 0.39.0 cold | 0.39.0 warm |
|---|---:|---:|---:|---:|---:|---:|
| `hw/ip/aes/rtl/aes.sv` | 22.3 ms | 22.0 ms | **19.3 ms** | **18.5 ms** | 18.7 ms | 16.5 ms |
| `hw/ip/kmac/rtl/kmac.sv` | 33.5 ms | 18.1 ms | 32.9 ms | 25.9 ms | 32.5 ms | 23.9 ms |
| `hw/ip/hmac/rtl/hmac.sv` | 18.2 ms | 12.2 ms | 30.4 ms | 20.4 ms | 32.1 ms | 22.1 ms |
| `hw/ip/spi_device/rtl/spi_device.sv` | 83.4 ms | 45.7 ms | 85.2 ms | 37.0 ms | 84.0 ms | 35.8 ms |
`spi_device` is still the ceiling for the reason take 1 gave. The `hmac` row is
the one that moved the wrong way (12.2 → 20.4 ms warm) and 0.39.0 shows the
same 22.1, so it is not a 0.43.0 change; see §8.4.
### 5b. At the default scope — take 2's headline regression is 4× smaller
| Widening `didOpen` | T2 cold | T2 warm | **0.43.0 cold** | **0.43.0 warm** | 0.39.0 cold | 0.39.0 warm |
|---|---:|---:|---:|---:|---:|---:|
| `aes.sv` (widens `hw/ip/aes` → **`hw/ip`, 1 807 files**) | 1 731 ms | 1 411 – 1 568 ms | **1 081.6 ms** | **365.1 ms** | 1 078.6 ms | 355.5 ms |
| `kmac.sv` (already in scope) | 3.9 ms | 2.7 ms | 24.3 ms | 31.1 ms | 23.9 ms | 30.0 ms |
| `hmac.sv` (already in scope) | 3.6 ms | 2.1 ms | 22.6 ms | 21.1 ms | 24.8 ms | 22.1 ms |
| `spi_device.sv` (already in scope) | 3.6 ms | 4.0 ms | 47.6 ms | 51.2 ms | 46.3 ms | 49.4 ms |
**The first row is the best news in this document.** Take 2 called the ~1.5 s
first-RTL-open at the shipped default "the wave's one real regression" and "a
real 1.5-second hang on the single most common navigation a Verilog user
performs". It is now **365 ms warm** — a 3.9× improvement — and the warm case
finally beats the cold one, which take 2's did not (1 411 warm vs 1 731 cold
there; 365 warm vs 1 082 cold here). The index cache now serves the widen.
0.39.0 shows the same number, so the credit belongs to whatever landed between
`ee1efe3` and 0.39.0, not to §37 or §41–§43.
The other three rows moved the wrong way and are §8.4.
### 5c. What the widen does to the slow requests
Take 2's §5c shape: `aes.sv` is the *only* buffer opened, so the scope is
whatever that one file raises, and the same requests are asked at all three
configs. 0.43.0, lazy client, first / repeats:
| | T2 `depth0` | T2 default | T2 workspace | **0.43 `depth0`** | **0.43 default** | **0.43 workspace** |
|---|---:|---:|---:|---:|---:|---:|
| `codeAction` on the `prim_lc_sync` instantiation | 4.7 ms | 7.0 ms | 39.2 ms | **3.5 / 3.0–3.3** | **4.6 / 4.1–4.9** | **7.2 / 5.5–6.6** |
| `codeAction` on the `aes_reg_top` instantiation | — | — | — | 21.1 / 14.6–15.8 | 21.4 / 15.5–18.1 | 25.1 / 17.5–20.4 |
| `prepareRename` on `module aes` | 0.09 ms | 0.08 ms | 0.07 ms | **0.09 / 0.05–0.06** | 0.08 / 0.04–0.10 | 0.10 / 0.04–0.06 |
| `rename` on `module aes` | 10.5 ms | 15.8 ms | 115 ms | **10.7 / 10.1–10.6** | 21.0 / 19.9–20.8 | 141.6 / 139.7–156.9 |
| `workspace/symbol "aes"` (256 each) | 4.0 ms | 7.8 ms | 6.6 ms | 1.8 / 1.5–1.6 | 4.0 / 3.3–3.6 | 7.3 / 6.3–6.8 |
Take 2's cursor for the first row was "the instantiation" in a table whose
client is gone; take 3 names two instantiations in `aes.sv` and gives both,
because they differ by 5× for a reason worth seeing.
`prepareRename` is still flat in scope size — 0.04–0.10 ms at 40 files, at
1 807 and at 3 976 — which was the wave's aim. `rename` still scales with the
fan-out (10.7 → 141.6 ms), exactly as take 2 described. **The lazy
`codeAction` is nearly flat too**: 3.5 → 7.2 ms across a 100× scope range for
`prim_lc_sync`, against the eager path's 39 ms at workspace scope in take 2.
The `aes_reg_top` row is the counter-example and the shape of what is left:
21–25 ms, barely moving with scope, because the whole bill is reading and
parsing that module's own 1 945-line declaration file — a per-cursor cost the
offer cannot avoid without caching the declaration parse.
---
## 6. `codeAction`, offer and resolve — the round's main result
### 6a. Cost against the module's fan-out, three shapes
Workspace scope, warm cache, cursor on a module instantiation, four tries each.
"Lazy" is a client that advertises
`textDocument.codeAction.resolveSupport.properties: ["edit"]` (what VS Code
sends); "eager" is a client that does not.
| Module at the cursor | Files instantiating it | T2 (eager only) | 0.39.0 eager | **0.43.0 eager** | **0.43.0 lazy offer** | Actions |
|---|---:|---:|---:|---:|---:|---:|
| `aes_reg_top` (in `aes.sv`) | 1 | 19.8 / 13.2–17.4 | 16.9 / 13.2–14.3 | 27.7 / 16.3–21.8 | **27.1 / 16.4–20.6** | 0 |
| `aes` (in `tb.sv`) | 6 | 39.2 / 36.4–38.2 | 59.7 / 45.8–46.1 | 66.1 / 45.7–48.2 | **5.15 / 4.05–4.24** | 0 |
| `prim_lc_sync` (in `aes.sv`) | 42 | 123.5 / 94.4–95.3 | 137.7 / 125.4–126.8 | 148.0 / 128.9–130.4 | **17.3 / 7.2–8.6** | 0 |
| `prim_alert_sender` (in `aes.sv`) | 67 | 163.6 / 138.8–139.8 | 210.3 / 191.7–194.6 | 213.4 / 196.0–196.5 | **14.8 / 8.6–10.8** | 0 |
| `prim_flop_2sync` (in `aon_timer.sv`) | 128 | 200.7 / 184.9–186.2 | 267.5 / 230.7–246.4 | 270.2 / 252.9–255.2 | **24.0 / 15.6–16.9** | 0 |
| *(contrast) a comment line* | — | 0.70 / 0.47–0.49 | 4.50 / 0.56–0.87 | 1.80 / 0.71–0.78 | **1.69 / 0.66–0.81** | 0 |
| **`aes` in `aes_wrap.sv` — the one cursor that offers** | 6 | — | 119.7 / 117.4–119.3 | 143.8 / 123.9–124.4 | **33.3 / 21.2–26.8** | **1** |
Two results, and they point in opposite directions.
**The lazy offer works, and it is the round's headline.** At a 128-file fan-out
the offer is **15.6–16.9 ms against the eager path's 252.9–255.2 ms — 16×** —
and, unlike the eager path, it does not track the fan-out at all: 4 ms at 6
files, 8 ms at 42, 9 ms at 67, 16 ms at 128. What cost remains is the cursor's
*own* file plus the instantiated module's declaration file, which is why the
outlier is `aes_reg_top` (16–21 ms): that declaration is a 1 945-line, 51 KB
autogenerated register file, and reading one of those is the whole bill.
Take 2's "reads as a hang" line at ~200 ms is no longer crossed anywhere.
**`aes_reg_top` is the one cursor where the lazy shape is not a win**, and it
is worth saying plainly: 27.1 / 16.4–20.6 ms at 0.43.0 against 0.39.0's eager
16.9 / 13.2–14.3 ms. At a fan-out of 1 there is nothing for laziness to skip —
the eager path reads one instantiating file, the lazy path reads the module's
declaration, and here the declaration is the bigger of the two. It is one
frame, on the cheapest fan-out there is, and it does not change the direction
of the row above it; it is recorded so nobody re-derives it as a regression.
**The eager path got ~1.37× slower between take 2 and 0.39.0**, and 0.43.0
holds that level. 95 → 126 ms at 42 files, 139 → 193 at 67, 185 → 246 at 128 —
a consistent factor across four fan-out points, on a night whose scan rows are
*faster* than take 2's, so it is not the machine. It is filed as §8.2. Note who
pays it: only a client without `resolveSupport`, which since 0.41.0 is a
shrinking population, but Vim/Neovim setups and simple clients are in it.
**The measured offer is now `O(1)` in the fan-out, and the resolve is `O(fan-out)`
paid only on click.** For the one opentitan cursor that offers an action:
| | offer | resolve | total, if the user clicks | one-shot (eager client) |
|---|---:|---:|---:|---:|
| `aes_wrap.sv` 0-based 78:2, "lucisv: connect 2 missing ports" | 33.3 / 21.2–26.8 ms | **119.5 / 119.5–121.9 ms** | ~145 ms | 143.8 / 123.9–124.4 ms |
The `data`/`edit` split behaves exactly as §37.1 specifies: the lazy offer
carries `data` and **no** `edit`; `codeAction/resolve` returns the same title
with a 1-file `WorkspaceEdit`; the eager offer carries the edit inline. Both
titles are byte-identical (`lucisv: connect 2 missing ports`).
### 6b. How rare an offer actually is — a new measurement
Take 2 recorded "0 actions after 95–186 ms of work" as a surprise and asked for
a cheap pre-check. Take 3 measured how common that is. A sweep of every
instantiation-shaped line in **205 RTL files** — all 165 of `hw/ip/prim/rtl`
and all 40 of `hw/ip/aes/rtl` — found **exactly one position that offers a port
refactoring**: `hw/ip/aes/rtl/aes_wrap.sv` at 0-based 78:2. A separate sweep of *every*
identifier position in `hw/ip/prim/rtl/prim_lc_sync.sv` (557 identifier starts) found
zero.
That is the real shape of the problem take 2 pointed at, and it is the
strongest argument for §37.1 that exists: on this corpus the eager path spent
95–255 ms per cursor move to answer "no" essentially always. The two
refactorings are refused for structural reasons, not accidental ones —
`remove port` refuses when the module's own body still uses the port (real RTL
always does), and `connect missing ports` needs an instantiation that omits
one (real RTL rarely does). Nothing is broken; the lightbulb is simply almost
never lit, which is why computing its edit eagerly was the wrong trade.
### 6c. `prepareRename` and `rename`
`prepareRename` remains flat and free: 0.05–0.16 ms at every scope, on both
binaries, with the byte-identical answer take 2 pinned
(`{"placeholder":"aes","range":{"start":{"line":44,"character":2},"end":{"line":44,"character":5}}}`).
`rename` is 151.8 ms first / 139.1–140.7 repeats at 0.43.0 and
147.4 / 137.4–139.1 at 0.39.0, against take 2's 115 / 107.5–121.4. **It now
edits 9 files rather than take 2's 7**, so the per-edited-file cost is
16.9 ms against take 2's 16.4 — flat. The extra two files are the same
reference-set growth §4b sees. Variance stays tight (1.09× across repeats;
take 1's was 2.4×).
### 6d. `completion`
| Typed prefix | T2 items | T2 | **0.43.0** | 0.39.0 | 0.43 items |
|---|---:|---:|---:|---:|---:|
| `` (empty) | 512 | 14.8 – 18.6 ms | **9.5 / 2.3 – 2.8 ms** | 5.2 / 3.0 – 3.3 ms | 512 |
| `a` | 512 | 15.9 – 19.4 ms | **3.2 / 2.5 – 2.7 ms** | 3.8 / 3.0 – 3.1 ms | 512 |
| `ae` | 483 | 16.8 – 18.5 ms | **4.0 / 2.6 – 2.9 ms** | 3.9 / 2.8 – 2.9 ms | 512 |
| `aes` | 482 | 16.1 – 17.5 ms | 10.4 / 7.8 – 9.2 ms | 9.6 / 7.1 – 8.2 ms | 512 |
| `aes_` | 476 | 15.9 – 17.4 ms | 7.5 / 6.8 – 8.2 ms | 8.1 / 6.5 – 7.0 ms | 512 |
| `prim_` | 339 | 6.1 – 6.9 ms | 5.1 / 4.0 – 4.4 ms | 4.8 / 3.6 – 3.8 ms | 512 |
| `clk` | 512 | 2.8 – 3.0 ms | 4.4 / 3.3 – 3.9 ms | 4.7 / 3.4 – 3.6 ms | 512 |
| `aes_reg` | 20 | 0.36 – 0.63 ms | 3.8 / 2.9 – 3.0 ms | 3.9 / 2.6 – 2.9 ms | **512** |
| `zzzz` | 1 | 0.11 – 0.13 ms | 1.4 / 0.31 – 0.34 ms | 1.4 / 0.32 – 0.59 ms | 1 |
**Take 2's 15–18 ms plateau at 0–4 typed characters is gone: the whole curve is
2–10 ms**, another change that landed before 0.39.0. Take 2's §8 item 3
("four dropped frames per identifier typed") is closed.
Two honest caveats on this table. The item counts changed — `aes_reg` returns
512 rather than 20, and `ae`/`aes`/`aes_` return 512 rather than 476–483 —
so the two `aes_reg` numbers are not measuring the same work, and the row
that reads "slower" (0.6 → 3.0 ms) is answering 25× as many items. And the
curve's shape inverted again: `aes`/`aes_` (7–9 ms) are now the *worst*
prefixes, above the empty one (2.5 ms), where take 2 had them roughly level.
---
## 7. The CLI sweeps — first time measured
`format --check` and `check` over five trees, three binaries, three tries each,
wall clock and peak RSS from `/usr/bin/time -l`, everything under
`tools/guard.sh`. The formatter cache lives in a scratch `--cache-dir` outside
the opentitan tree; nothing was ever written into the corpus.
| Tree | files | command | 0.39.0 wall (first / repeats) | 0.41.0 | **0.43.0** | peak RSS, 0.39 → 0.43 |
|---|---:|---|---:|---:|---:|---:|
| `hw/ip` | 1 807 | `format --check`, cold cache | 0.67 / 0.59–0.62 s | 0.66 / 0.61–0.64 | **0.63 / 0.61–0.66** | 211 → 233 MB |
| `hw/ip` | | `format --check`, warm cache | 0.65 / 0.60–0.62 | 0.67 / 0.61–0.64 | **0.61 / 0.63–0.68** | 220 → 225 MB |
| `hw/ip` | | `check` (default rules) | 0.37 / 0.36–0.37 | 0.39 / 0.37–0.39 | **0.40 / 0.39–0.41** | 191 → 194 MB |
| `hw/ip` | | `check --select error,warning,style` | 0.42 / 0.41–0.43 | 0.43 / 0.43 | **0.45 / 0.47** | 187 → 198 MB |
| `hw/top_earlgrey/ip` | 46 | `format --check`, cold / warm | 0.04 / 0.04 | 0.04 / 0.03 | **0.04 / 0.03** | 34 → 39 MB |
| `hw/top_earlgrey/ip` | | `check` / `--select …` | 0.03 / 0.02 | 0.02 / 0.02 | **0.02 / 0.03** | 35 → 37 MB |
| `hw/top_darjeeling/ip` | 49 | `format --check`, cold / warm | 0.03 / 0.03 | 0.03 / 0.03 | **0.02 / 0.03** | 23 → 26 MB |
| `hw/top_darjeeling/ip` | | `check` / `--select …` | 0.02 / 0.02 | 0.02 / 0.02 | **0.02 / 0.02** | 28 → 29 MB |
| `hw/dv` | 365 | `format --check`, cold / warm | 0.06 / 0.06 | 0.07 / 0.06 | **0.07 / 0.07** | 32 → 30 MB |
| `hw/dv` | | `check` / `--select …` | 0.05 / 0.06 | 0.05 / 0.07 | **0.06 / 0.07** | 33 → 33 MB |
| `hw/vendor` | 287 | `format --check`, cold / warm | 0.11 / 0.10 | 0.11 / 0.11 | **0.12 / 0.11** | 51 → 48 MB |
| `hw/vendor` | | `check` / `--select …` | 0.07 / 0.08 | 0.07 / 0.09 | **0.08 / 0.10** | 53 → 58 MB |
- **The CLI is fast and essentially unchanged.** The biggest tree, 1 807 files,
is checked for formatting in 0.6 s and linted in 0.4 s, on ten cores, at
~200–230 MB.
- **`check` is 6–10% slower at 0.43.0 than at 0.39.0** on the two trees big
enough to measure it (`hw/ip` 0.367 → 0.400 s default rules, 0.420 → 0.463 s all
classes; `hw/vendor` 0.070 → 0.083 s). Consistent across all three tries and
both rule sets, and 0.41.0 sits between. Small in absolute terms; filed as
§8.5.
- **The formatter cache buys nothing on opentitan, and that is expected.** The
cold and warm rows are within noise of each other everywhere, because the
cache remembers *already-formatted* files and opentitan has almost none:
30 of 1 806 in `hw/ip`, 3 of 365 in `hw/dv`, 12 of 287 in `hw/vendor`. The
stores written are 4–8 KB. A tree that lucisv already formats would see the
opposite.
- Peak RSS scales with the tree, not the version: 23–58 MB for the four small
trees, 183–249 MB for `hw/ip`. No version is more than ~10% off any other on
the same row, and the ordering is not consistent, so nothing is claimed.
### 7a. Failure counts per tree, and every per-file outcome that changed
`format --check --no-cache` and `check`, full runs, both binaries:
| Tree | 0.39.0 `format --check` | **0.43.0** |
|---|---|---|
| `hw/ip` | 1773 would reformat, 30 unchanged, **4 failed** | **1772** would reformat, 30 unchanged, 4 failed |
| `hw/top_earlgrey/ip` | 46 would reformat | 46 would reformat |
| `hw/top_darjeeling/ip` | 48 would reformat, 1 failed | 48 would reformat, 1 failed |
| `hw/dv` | 361 would reformat, 3 unchanged, **1 failed** | **362** would reformat, 3 unchanged, **0 failed** |
| `hw/vendor` | 270 would reformat, 12 unchanged, **5 failed** | **271** would reformat, 12 unchanged, **4 failed** |
`check` findings: `hw/ip` 446 → **445**; `hw/top_earlgrey/ip` 14;
`hw/top_darjeeling/ip` 23; `hw/dv` 85; `hw/vendor` 231 + 1 file that cannot be
checked — every one of those unchanged. With `--select error,warning,style`:
`hw/ip` 7 735 → **7 734**, and 551 / 382 / 1 158 / 1 666 unchanged.
**Exactly three per-file outcomes changed since 0.39.0, and all three were
predicted:**
1. `hw/dv/sv/jtag_agent/jtag_if.sv` — was `parse error: 163:1: expected
\`endinterface\` (found "<eof>")`, now **would reformat**. §38.1, the rival
headers in a conditional region.
2. `hw/vendor/pulp_riscv_dbg/tb/unused/SimDTM.sv` — was `parse error: 40:15:
expected identifier (found "#")`, now **would reformat**. §38.2, the net
delay after the type.
3. `hw/ip/tlul/rtl/tlul_adapter_vh.sv` — was reported *beside* its symlink
alias `tlul_adapter_shim.sv`; now only the alias (the first spelling seen)
is reported, and the target is deduplicated away. §41.2, dedup by canonical
identity. The same one line disappears from `check`
(`tlul_adapter_vh.sv:43:101: style: line is 101 characters`), which is where
the 446 → 445 and 7 735 → 7 734 come from.
**Nothing else moved**, on any tree, for either command, at any rule set.
0.41.0's outcomes are byte-identical to 0.39.0's, which places all three
changes in 0.42.0/0.43.0 exactly as their sections say.
The seven files that still fail to parse, for the record:
`hw/ip/edn/dv/env/edn_env_cfg.sv`, `hw/ip/kmac/fpv/tb/keccak_2share_fpv.sv`,
`hw/ip/kmac/pre_dv/kmac_reduced_tb/rtl/kmac_reduced_tb.sv`,
`hw/ip/spi_device/dv/env/spi_device_scoreboard.sv`,
`hw/top_darjeeling/ip/ast/rtl/ast.sv` (a locally modified file),
`hw/vendor/lowrisc_ibex/dv/formal/check/peek/compare_helper.sv`,
`hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/riscv_dv_extension/riscv_core_setting.tpl.sv`
(a template, not SystemVerilog), `hw/vendor/lowrisc_ibex/syn/rtl/latch_map.v`,
`hw/vendor/lowrisc_ibex/vendor/google_riscv-dv/src/riscv_instr_cover_group.sv`.
---
## 8. Findings — filed, not fixed
Ordered by how much they matter. Nothing in this list was fixed in this round.
### 8.1 CREDIT, not a finding — the five things that got faster
Stated first so the rest reads in proportion.
| What | take 2 | take 3 | Credit |
|---|---:|---:|---|
| `codeAction` at the `aes` cursor, resolving client | 39.2 / 36.4–37.6 ms | **5.15 / 4.05–4.24 ms** | **§37.1** (0.41.0) |
| `codeAction` at a 128-file fan-out, resolving client | 200.7 / 184.9–186.2 ms | **24.0 / 15.6–16.9 ms** | **§37.1** |
| The first RTL `didOpen` at the default scope, warm | 1 411–1 568 ms | **365 ms** | pre-0.39.0 (take 2's §8.1 regression) |
| `completion` at 0–4 typed characters | 14.8–19.4 ms | **2.3–4.0 ms** | pre-0.39.0 (take 2's §8.3 residual) |
| `definition` on `aes`, first try | 0.27 ms | 0.19 ms (0.39.0: 0.41 ms) | §37.3's index-only `locate`, ~2× on the first try; repeats were already at the floor |
Two of those close take-2 findings outright (its §8 items 1 and 3), and §37.2's
ruling closes its item 9.
### 8.2 FINDING (medium) — the eager `codeAction` path is ~1.37× slower than take 2
**What.** For a client that does *not* advertise
`codeAction.resolveSupport.properties: ["edit"]`, `codeAction` on a module
instantiation costs 1.35–1.40× what take 2 measured, at every fan-out:
| fan-out | take 2 repeats | 0.39.0 repeats | 0.43.0 repeats | factor vs T2 |
|---:|---:|---:|---:|---:|
| 42 | 94.4 – 95.3 ms | 125.4 – 126.8 ms | 128.9 – 130.4 ms | 1.37× |
| 67 | 138.8 – 139.8 ms | 191.7 – 194.6 ms | 196.0 – 196.5 ms | 1.40× |
| 128 | 184.9 – 186.2 ms | 230.7 – 246.4 ms | 252.9 – 255.2 ms | 1.37× |
**Reproduce.** `bench.py codeaction eager`; cursor on `prim_flop_2sync #(` in
`hw/ip/aes/../aon_timer/rtl/aon_timer.sv` at 0-based 83:2, workspace scope,
warm store, `tb.sv` also open; four tries. Server-side `--verbose` lines agree
with the wire to 0.3 ms (§0), so this is server work, not transport.
**Where it landed.** Between `ee1efe3` (take 2) and 0.39.0 — 0.39.0 already
shows it and 0.43.0 only adds ~3%. Not bisected; the candidates are §29–§35,
of which the linter expansion (§33–§35, 73 rules) is the one that touched
per-file work. Not attributed here.
**Why it is medium, not high.** It is paid only by clients without
`resolveSupport`, it crosses take 2's 200 ms "reads as a hang" line only at
fan-outs above ~67, and the same cursors cost 8–17 ms for a client that can
resolve. But it is still a per-cursor-move request and the trend is the wrong
way.
### 8.3 FINDING (low) — `rename` and its followers are ~1.4× slower in absolute terms
151.8 / 139.1–140.7 ms against take 2's 115 / 107.5–121.4, and anything queued
behind it pays 160.8 ms. **Half the difference is more work**: the edit set is
9 files rather than 7 (16.9 ms per edited file against 16.4 — flat). 0.39.0
measures the same, so nothing in 0.41.0–0.43.0 caused it. Reproduce:
`bench.py rename`, `textDocument/rename` on `aes` at `tb.sv` 44:2, newName
`aes_renamed`, workspace scope; the edits are discarded.
### 8.4 FINDING (low–medium) — a `didOpen` of a file already in scope costs 21–51 ms before the next request is answered
**What.** At the default scope, take 2 measured 2.1–4.0 ms for the request
following a `didOpen` of `kmac.sv` / `hmac.sv` / `spi_device.sv` — files
already inside `hw/ip` after the `aes.sv` widen, so no rescan happens. Take 3
measures 21–51 ms for the same three, on both binaries.
| file | size | T2 warm | 0.43.0 warm | 0.39.0 warm |
|---|---:|---:|---:|---:|
| `hmac.sv` | 33 KB | 2.1 ms | 21.1 ms | 22.1 ms |
| `kmac.sv` | 53 KB | 2.7 ms | 31.1 ms | 30.0 ms |
| `spi_device.sv` | 67 KB | 4.0 ms | 51.2 ms | 49.4 ms |
**It is the open, not the request.** A *second* `definition` at the same
position, issued right after the first, costs **0.07–0.21 ms** in every one of
these cells. So the 21–51 ms is work the `didOpen` queues (parse and analysis
of the newly opened buffer) that the next request waits behind, and it scales
with the file, which take 2's flat 2–4 ms did not.
**Caveat, stated plainly.** Take 2's client is gone from disk, so I cannot
prove its follow-up request was the same one at the same position. If it used a
cheaper barrier the comparison is not like-for-like. What take 3 *can* assert
without reference to take 2: opening a 67 KB file that is already indexed
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
(`--select error,warning,style`); `hw/vendor`: 0.070 → 0.083 s and
0.083 → 0.097 s. Consistent
across three tries per cell, with 0.41.0 between the two, so it accumulated
across 0.41–0.43 rather than in one release. `format --check` did not move
(0.61 → 0.63 s on `hw/ip`, inside the spread). Candidates in that window
include §41.2's `fs::canonicalize` per existing file in `dedup` and §42's
config plumbing; not bisected. 40 ms on the largest tree in opentitan is not a
user-visible cost — filed so the next round can see if it keeps accumulating.
### 8.6 FINDING (low) — `workspace/symbol` keeps drifting up
6.6 (take 1) → 6.6–7.4 (take 2) → **7.2–7.9 (0.43.0)**, 8.4–8.7 at 0.39.0, for
the same 256 results. Take 2 already flagged this row as "~13% up and worth one
glance". 0.43.0 is *better* than 0.39.0 here, so the drift is not monotonic,
but the row has now moved in three consecutive takes and nothing in the
document explains it.
### 8.7 SURPRISE — the port refactorings are offered at 1 of 205 RTL files
Detailed in §6b. Not a defect: both refactorings refuse for structural reasons
that real RTL always satisfies. Recorded because it is the measurement that
justifies §37.1 after the fact, and because a future round asking "why is
`codeAction` slow" should know that it is almost always slow to say no.
### 8.8 STILL SLOW — the cold workspace scan at ~2.8 s
Essentially unmoved across three takes (3 003 → 2 958 → 2 767 mean), and still
the largest absolute number in the document. Once per session per cold cache;
never any round's target.
### 8.9 Movements inside the noise, listed and dismissed
`prepareRename` 0.07 → 0.31 ms first try, `documentHighlight` 0.04 → 0.10,
`foldingRange` 0.05 → 0.10, `diagnostic` 0.11 → 0.34, `didChange` flush
0.48 → 0.95, `inlayHint` 0.38 → 0.49, `semanticTokens` 0.16 → 0.21. Every one
of these is within 0.3 ms of take 2 and sits on a transport floor that is
0.04 ms fatter in this harness (§0); 0.39.0 measures the same as 0.43.0 on all
of them. **No conclusion should be drawn from any of them.** The `diagnostic`
row additionally answers 0 items rather than take 2's 1 (§1a).
---
## 9. Methodology and caveats — read before quoting any number
Take 1's and take 2's caveats still apply. The take-3-specific ones:
- **Three tries per row, first try and repeat range both reported.** "First" is
the request issued as the first real request of a dedicated session, after
the scan settled; "repeats" is the 2nd–4th identical request in that same
session. Where a row needed its own session (`codeAction`, `rename`,
`prepareRename`, each fan-out cursor, each scope/cache cell) it got one.
- **There *is* a server-side column this time**, from the shipped `--verbose`
flag, and it confirms the wire (§0). Nothing was instrumented for this round;
no code in the lucisv repo was modified except the creation of this file, the
`docs/perf/README.md` entry and `TODO.md`'s §40 ticks. No `cargo` command ran
in the main tree.
- **The comparison is binary-to-binary.** 0.43.0 is the packaged release build
at `73799f3`; 0.39.0 was built for this round from the `v0.39.0` tag in a
scratch `git worktree` under the scratchpad (`cargo build --release -p
lucisv_server`), which was removed afterwards. The main tree was never
checked out, reset or stashed.
- **Machine state.** Apple M1 Max, 10 cores, 64 GB, macOS 27.0 (26A5425a).
**The first 20 minutes of the session were contended** — two `rustc`
processes from an unrelated build ran at 99% CPU, load average 6–13 — and the
only measurements taken in that window were the untimed per-file outcome
sweeps of §7a, which are correctness, not timing. Every timed number in this
document was taken after those processes exited, at load average 2–4 with
only the editor and this agent running. No `cargo` build of this repo ran
during any timed measurement.
- **The guard.** Every server session, every `lucisv` invocation and the one
`cargo build` went through `tools/guard.sh -m 8 -t 1800`. **No guard kill
occurred**, and the largest resident set any command reached was 249 MB
(`lucisv format --check hw/ip`), 3% of the 8 GB limit.
- **The opentitan checkout was never written.** `git status --porcelain` was
checked after every phase and after the last run, and reports the same three
pre-existing modified files throughout: `hw/ip/aes/dv/tb/tb.sv`,
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`.
`rename`, `codeAction/resolve` and `willRenameFiles`-shaped requests return
edits; the client discarded every one. The formatter cache was directed to a
scratch `--cache-dir` and the index cache to a scratch
`initializationOptions.storagePath`; neither default (`.lucisv_cache` in the
*current* directory, `~/Library/Caches/lucisv/index/<key>`) lands inside the
corpus, and both were overridden anyway.
- **One corpus difference from take 2** — `tb.sv` has been reformatted since,
so it raises no diagnostic and offers no `source.fixAll` action (§1a). Two
take-2 columns are therefore not comparable, and both are called out where
they appear.
- **Take 2's client no longer exists on disk**, so take 3's is a
reimplementation from take 2's description, not the same code. Its transport
floor is ~0.04 ms fatter (§0). Every sub-0.3 ms comparison against take 2
should be read with that in mind, and §8.9 dismisses the lot.
- **Page cache is hot and hotter than ever** — opentitan has now been walked by
three measurement sessions and by tonight's outcome sweeps. "Cold cache"
means *lucisv's* store was deleted, not that the OS file cache was dropped.
- **Sub-millisecond results were stable to ±0.05 ms** across ~60 sessions;
ten-to-hundred-millisecond ones should be read as ±10% (tighter than take
2's ±20%, because the machine was quieter); the multi-second scan rows as
±5% (take 3's six warm workspace scans span 12 ms).
- **The fan-out counts in §6a are `grep`-derived**
(`grep -rlE '^\s*<module>( |#|$)'` over `*.sv`), reproducing take 2's counts
exactly (1 / 6 / 42 / 67 / 128).
- **`--select error,warning,style` is not "all rules"** — it is the three rule
classes by name, which is what §40 asked for; a rule outside those classes
would not run.
---
## 10. Raw logs
All under `…/7b09ba01-…/scratchpad/perf3/` (removed after this document was
written; the numbers here are the record):
| File | What |
|---|---|
| `lspclient.py` | the LSP client — framing, the configuration pull, per-session capabilities, `--verbose` capture |
| `bench.py` | phases `startup` / `nav` / `codeaction` / `portaction` / `rename` / `blockers` / `completion` / `widen` / `diagnostics` |
| `verbose_probe.py` | §0 — the server's own timing lines beside the wire |
| `realfolder.py` | §5c — the slow requests with only `aes.sv` open, per scope |
| `probe_offer.py`, `probe_ws.py` | §6b — the sweeps that found one offered action in 205 files |
| `sweep.sh`, `sweeptable.py` | §7 — the timed CLI sweeps and their table |
| `outcomes.sh` | §7a — the per-file outcome runs for the 0.39.0 → 0.43.0 diff |
| `results.jsonl`, `logs/*.log` | every measurement, machine-readable |