Files

performance-take4

TODO §58 — the fourth opentitan performance round. 0.49.0 against 0.43.0, with take 3's 0.43.0 column carried beside every row so each one is a before/after, and 0.39.0 kept for the CLI sweeps. Output: docs/performance_take4.md, a docs/perf/README.md entry, and — the round's one durable artefact — a committed harness in tools/perf/.

Goal

Measure what 0.44–0.49 did to the server and the CLI on a 3 976-file corpus, with the same table shapes take 3 used, so a reader can put the two documents side by side and read a row across four releases. Read-only: a regression is filed with a reproduction, never fixed here. And leave behind the client the last three rounds each lost — take 2's scripts were gone when take 3 ran, and take 3's were gone when this one started, so take 3's numbers had to be re-derived from take 2's prose. tools/perf/ ends that.

Assumptions

  • The tree at 4c2dae3 is 0.49.0. Verified: target/release/lucisv --version prints 0.49.0, and the server binary's mtime (01:13) is later than the last change under crates/ (01:12:49), so no rebuild was needed before timing.
  • The two servers differ only in their code. Both were driven by the same Python client, in the same session, on the same corpus commit, within one hour of each other. That is what makes tonight's 0.43.0 column — not take 3's — the honest baseline: the harness and the machine are held fixed.
  • The machine is a desktop, and it was busier than take 3's. Load average 3.7–7.1 throughout, with WindowServer at 45–51% and loginwindow at 24–29%. Take 3 measured at load 2–4. Sub-millisecond rows therefore sit on a fatter floor than take 3's; §9 says so and §8.9 dismisses the lot. Every conclusion below is drawn from a 0.49.0-vs-0.43.0 pair taken on this machine, in this state.
  • --select error,warning,style is not "all rules" — three rule classes by name, which is what §58 asked for.
  • "Cold cache" is lucisv's store, not the OS page cache. opentitan has now been walked by four measurement rounds.

Handshakes

  • Consumes lucisv-server's wire protocol: initialize with initializationOptions.storagePath (index-persistence), workspace/configuration for the lucisv section (index-scope's index.scope / index.scopeDepth), --verbose's timing: <method> answered in <n> ms over window/logMessage (verbose-timing), and lucisv/moduleHierarchy with params: {} (dut-hierarchy). None of these is changed by this round.
  • Consumes the CLI's format --cache-dir <path> --check, format --no-cache --check and check [--select …]. Note the argument order: --cache-dir is a subcommand option, so it follows format.
  • Promises tools/perf/ to take 5: lspclient.py and bench.py keep their phase names and their results.jsonl row shape (phase/label/row/ms/n/note), so a later round can diff a row against this one by name. A phase that changes what it measures gets a new name rather than a new meaning.
  • Requests nothing of another module. Two observations that a future lane may want are filed as findings in docs/performance_take4.md §8, not as handshake requests, because this lane fixes nothing.

Status / TODO

  • harness in tools/perf/ with its README; runs from a clean checkout
  • server table re-measured, 0.49.0 vs 0.43.0 vs take 3 — take 4 §2
  • new rows: didOpen release numbers, the five refactoring offer sites, tail rename and instance-head completion, moduleHierarchy, index size and RSS
  • CLI sweeps, three binaries, RSS included; outcome diff since 0.43.0
  • docs/performance_take4.md + perf README entry
  • opentitan status unchanged after every phase; no guard kill
  • QA (TODO §58's last line) — PASS, see QA log

Work log

2026-09-07 (dev).

  • Read CLAUDE.md, TODO §58, docs/performance_take3.md in full, and the perf README's 2026-09-05 entry. Recorded provenance for all five binaries (§1). Confirmed the tree's server binary is current; no rebuild ran.
  • Built the 0.43.0 server from the v0.43.0 tag in a scratch git worktree under the scratchpad (57.75 s, under the guard). The main tree was never checked out, reset or stashed. The worktree was removed after the last measurement.
  • Wrote tools/perf/ — lspclient.py, sites.py, bench.py, sweep.sh, sweeptable.py, outcomes.sh, README.md. Standard library only. Deviations from take 3's client, all deliberate: sites are resolved from the file text at run time rather than hard-coded; the scan barrier is 1.5 s of silence rather than the $/progress end (the end report is followed by more chatter); and there is a probe phase, which is how the new offer sites below were found rather than guessed.
  • Found the new offer sites empirically. Swept every instantiation-shaped and import line in a set of RTL files with codeAction and kept the positions that actually offer. That turned up sha3_fpv.sv 54:4 (expand .*), aes_sbox_canright_masked.sv 42:2 (organize imports), aes_wrap.sv 66:2 (inline tlul_cmd_intg_gen) and confirmed take 3's aes_wrap.sv 78:2 (connect 2 missing ports). There is no convert to ANSI site: a scan of all 1 311 module headers in opentitan's hw/ found zero non-ANSI ones, so that row measures an ANSI header instead and the corpus fact is reported in §6b.
  • Found the §49 tail site empirically too. The first two candidates did not resolve — pwrmgr.sv's u_fsm.state_q sits inside a `-macro assertion argument, and pinmux.sv's u_reg.intg_err did not resolve either — so the round uses entropy_src_core.sv's u_entropy_src_main_sm.state_q, which does. The two that do not are recorded in §8.
  • Ran the untimed per-file outcome sweeps for all three CLI binaries, then the timed CLI sweeps, then the LSP phases for 0.49.0 and for 0.43.0. git -C opentitan status --porcelain was checked after every phase and reported the same three pre-existing modified files every time. No guard kill occurred; the largest resident set anything reached was 588 MB (lucisv-server after a warm workspace scan), 7% of the 8 GB limit.
  • Three phases (widen, blockers, rss) were first written with one try per cell; that violated §58's three-tries rule, so they were rewritten to loop and re-run on both binaries, and the single-try rows were deleted from results.jsonl before the re-run. Nothing else in the file was edited after it was written.
  • Split the harness after the measurements and re-verified it. bench.py reached 537 production lines, over §58's ~500; the phases for what 0.44–0.49 added moved to phases_new.py and the shared registry/config/session code to harness.py (330 / 152 / 76 production lines). Every one of the 20 phases was then re-run through the split files, and ten rows were checked against the document within its stated tolerances — didOpen pinmux_reg_top.sv (doc 112.1 / 127.9–130.7 → 125.6 / 113.1–129.7 ms), the tail rename (793.2 / 750.7–751.9 → 785.0 / 746.3–753.9), the 128-fan-out eager codeAction (511.8 / 467.1–473.6 → 506.8 / 474.2), moduleHierarchy (76.2 / 41.1–53.8 → 68.7 / 41.1–53.1), the port-action resolve (163.9 / 158.2–159.5 → 163.1 / 157.3–160.4), the warm workspace scan (1 266 → 1 248), cold RSS (542 736 → 541 152 KB), rename on aes (165.1 / 133.5–139.4 → 164.5 / 137.2), didOpen spi_device.sv (15.5 / 13.8–15.1 → 13.7 / 15.3–15.0) and tailcompletion (1.11 / 0.45–0.53 → 0.96 / 0.47). All inside tolerance; the verification run is scratchpad/verify.jsonl, labelled verify-0.49.0.
  • Wrote docs/performance_take4.md (§0–§10), the perf README entry, and ticked §58's dev lines in TODO.md.

QA log

2026-09-07 (QA).

Read CLAUDE.md, TODO §58, this README, docs/performance_take4.md in full (961 lines), tools/perf/README.md, the harness source, and the dev's raw logs at ~/.cache/lucisv-perf/take4/{results.jsonl,verify.jsonl} and the scratchpad (logs/, outcomes/, sweep/, census.py + logs/census-0.49.0.txt).

Setup. python3 -m py_compile tools/perf/*.py — clean. Built the 0.43.0 server from a fresh clone (not a worktree, per the hard rules): git clone -q --no-checkout … && git checkout -q v0.43.0, then tools/guard.sh -m 8 -t 1800 -- cargo build --release -p lucisv_server (58.10 s, no kill). Binary sha256 7f0f27d6…, matches §1's row exactly. Verified target/release/lucisv --version → 0.49.0 and lucisv-server sha256 c6e40ecd…, matching §1. All three CLI baseline shas/sizes (0c943c4c…/3236768 B for 0.49.0, 89379a12…/2828576 B for 0.43.0) matched by direct shasum/ls.

1. Harness. Compiles clean. Ran every phase listed below through tools/perf/bench.py exactly as tools/perf/README.md documents — no undocumented step was needed. One thing the README doesn't spell out: bench.py's --tries N is the repeat count, and the printed/recorded list is [first, repeat×N] (so --tries 4 prints 5 numbers) — obvious once seen, but worth a line in the README for take 5.

2. Rows re-run, both binaries, committed harness (--tries 3 or 4 matching the phase; my raw rows are in scratchpad/qa/results/results.jsonl, labels 0.49.0-qa/0.43.0-qa):

Row Doc (first / repeats) QA re-run 0.49.0 QA re-run 0.43.0 Verdict
Workspace scan, cold 2712/2691–2712 (49) · 2645/2640–2656 (43) 2712.4/2690.9–2711.9 2637.0/2620.9–2632.3 in band
Workspace scan, warm 1266.1/1239.8–1285.6 (49) · 1173.4/1167.1–1173.6 (43) 1252.1/1244.7–1271.5 1183.6/1168.7–1185.3 in band
didOpen pinmux_reg_top.sv→request 112.1/127.9–130.7 (49) · 1605/1604–1611 (43) 127.5/103.4–126.5 (mean 119.1, doc mean 123.6, −3.6%) 1621.1/1518.6–1565.7 (mean 1568.4, doc mean 1607.4, −2.4%) in band (§9's ±10%/±5%)
codeAction prim_flop_2sync (128), lazy 15.0/8.1–10.5 17.5/7.2–11.0 13.3/9.8–11.5 in band
codeAction prim_flop_2sync (128), eager 511.8/467.1–473.6 511.8/468.8–473.1 (traced exactly to the dev's own row, see §4 below) — QA re-run: 497.2/468.4–479.1 271.0/237.0–241.2 in band
codeAction comment line, lazy (§8.2) 4.70/3.18–3.84 (49) · 2.17/1.12–1.32 (43) 2.81/2.24–2.38 (run1), 7.43/4.11–5.46 (run2) 1.81/1.15–1.61 see finding B below
rename on aes 165.1/133.5–139.4 (49) · 159.8/133.2–136.2 (43) 165.0/133.5–139.4 158.5/130.7–135.5 in band
completion at 0 chars 7.2/4.2–5.3 (49) · 7.8/4.2–5.4 (43) 7.1/3.9–5.1 9.0/4.4–5.0 in band
tail rename (§49, new row) 793.2/750.7–751.9 (49) · 88.0/65.8–66.7 (43) 777.8/747.9–751.2, tail edited 87.4/65.6–66.4, tail NOT edited in band, correctness match
moduleHierarchy (new row) 76.2/41.1–53.8 (49) · 70.3/41.0–48.8 (43) 71.9/40.8–53.9, 2 600 051 B, 1546/1529/schema 2 70.3/40.8–44.3 (a subset of retries) in band, payload byte-identical

10 rows re-run (task asked for 8), both binaries, all inside §9's stated tolerance bands except the comment-line row, which is finding B.

3. CLI outcome diff, independently re-derived, two trees (hw/ip, hw/top_earlgrey/ip), plus hw/top_darjeeling/ip to nail down the 17/2/1 split:

  • format --check --no-cache: diff against 0.43.0/0.49.0 is empty on both hw/ip (1777 lines each) and hw/top_earlgrey/ip (47 lines each) — byte-identical formatter verdicts, confirmed.
  • check (default rules): diff empty on both trees (446/15 lines) — byte-identical, confirmed.
  • check --select error,warning,style: hw/ip 7734→7751 (+17), hw/top_earlgrey/ip 551→553 (+2), hw/top_darjeeling/ip 382→383 (+1) — 17+2+1 = 20, every added line is a [unused-import] style finding, nothing else changed anywhere. Doc's claim confirmed exactly.
  • Re-timed format --check warm and check default on hw/ip, three tries, three binaries, /usr/bin/time -l: format warm 0.55–0.67 s across all three binaries (doc: 0.58–0.63); check default 0.35–0.41 s (doc: 0.34–0.41); check --select 0.46–0.60 s, confirming the 1.27×-ish slope (mine: 0.47 mean 0.43 → 0.59 mean 0.49, 1.26×; doc 1.27×). All in band.

4. §8.2 mechanism, read not fixed. crates/vlog_refactor/src/inline/mod.rs:73 (inline_site) and crates/vlog_refactor/src/extract/mod.rs:82 (extract_site) both call parse_source_tolerant(text) — a full tolerant parse of the whole buffer — on every invocation, and refuse (None) if that parse produced any diagnostic. Both are called from the server's code_actions gating on every textDocument/codeAction: crates/lucisv_server/src/inline_module.rs:50 and crates/lucisv_server/src/extract.rs:76/:113. The doc's claim — the gates parse the cursor's buffer on every request, unconditionally, offer or not — is accurate and the two file:line citations for inline_site check out exactly; the doc names extract_site in prose but doesn't cite its own definition/call site (extract/mod.rs:82, extract.rs:76) — a cosmetic citation gap, not a wrong claim, since I verified extract_site does the identical thing.

5. Attack — internal consistency and corpus facts.

  • Census (§6b, 2 440 positions, extract 89%/inline 11%). The dev's scratchpad/census.py + logs/census-0.49.0.txt gives files 205, positions 2440, extract 2171, inline 263, organize 12, connect 1 — matches the document exactly. I re-ran an independent subset (aes/rtl only, 40 files, edited dirs= in a copy of the script) and got 914 positions, extract 870 (95.2%), inline 129 (14.1%), organize 12, connect 1 — the organize/connect sites are byte-identical to the full run's list (all 12 organize sites and the 1 connect site live in aes/rtl), and the extract/inline proportions are in the same range; the difference from 89%/11% is explained by prim/rtl's different mix of item shapes, not an inconsistency.
  • "Zero non-ANSI headers of 1 311" (§6b). No script or log for this claim exists anywhere in tools/perf/ or the scratchpad — filed as finding A. I wrote an independent census (line-anchored module NAME regex, comments stripped, port-list scanned for input/output/ inout/ref) over all 3 932 .sv/.v files under opentitan/hw: 1310 module headers (doc: 1311, a 1-header methodology difference), 2 apparent "non-ANSI" hits that turned out to be false positives on inspection (hw/vendor/lowrisc_ibex/.../tb.sv and hw/vendor/pulp_riscv_dbg/tb/tb_top.sv — both module NAME #(params) ; with no port list at all, not a non-ANSI port list). Net: zero genuine non-ANSI headers, confirming the doc's claim in substance even though it isn't traceable to a committed artifact.
  • File-count sanity: find hw/ -name '*.sv' -o -name '*.v' | wc -l → 3932, matches §6b's "3 932 .sv/.v files" exactly.

6. Traceability sample (task asked for 25; I checked ~30). Every one of the following was found verbatim in results.jsonl, a sweep/*.txt log, logs/sweeptable.txt, an outcomes/*.txt file, or logs/census-0.49.0.txt: the §0 prim_flop_2sync (128) eager wire/verbose pair, the §1 sha256/size sextet, the §2 workspace-scan cold/warm rows, the didOpen pinmux_reg_top.sv row, the tail-rename row, codeAction prim_flop_2sync (128) eager and prim_alert_sender (67) eager, didOpen aes_core.sv, the expand .* offer+resolve pair, rename aes, the spi_device.sv widen cell, moduleHierarchy (both binaries, payload 2 600 051 B, 1546/1529/schema 2), the cold/warm RSS triples and index sizes (45404/39940 KB) for both binaries, every hw/ip row in sweeptable.txt (format cold/warm, check default/select, RSS), every outcome-count line (found 445/446/7751/7734/7735 violations, 1772/1773 files would be reformatted), and the load-average extremes (7.10, 3.68) in logs/outcomes-load-before.txt/logs/lsp-0.49.0-machine.txt. Not traceable: the §6b "1 311 module headers / zero non-ANSI" pair (finding A above) — no script, log, or note anywhere records how it was computed.

7. opentitan and tree status. git -C opentitan status --porcelain checked after every phase of my own re-runs (scan, didopen, codeaction ×2, rename, completion, hierarchy, tailrename, both outcome sweeps, both timed sweeps, the census re-run) — every single time, exactly the three pre-existing files: hw/ip/aes/dv/tb/tb.sv, hw/top_darjeeling/ip/ast/rtl/ast.sv, hw/top_earlgrey/ip/ast/rtl/ast.sv. Never written to otherwise. Main tree git status --short shows only the dev's untracked/modified files (TODO.md, docs/perf/README.md, docs/features/performance-take4/, docs/performance_take4.md, tools/perf/) plus this QA-log edit. No guard kill in any of my ~20 guarded invocations (server sessions, the one cargo build, CLI sweeps); largest RSS I observed was the 0.49.0 server's 588 608 KB after a warm scan, same as the doc reports.

Findings

A (low, traceability). docs/performance_take4.md:428-430's "zero non-ANSI headers" / "1 311 module headers" claim has no backing script or log anywhere in tools/perf/ or the scratchpad, unlike every other census in this round. This breaks tools/perf/README.md:103-104's own rule ("Nothing in the document may quote a number that is not in this file or in a sweep.sh / outcomes.sh log"). Independently reproduced as substantively correct (§5 above: 1310 headers, 0 genuine non-ANSI after excluding two no-port-list false positives) — not a correctness defect, but the number should not have shipped without a saved script, and a future round should add one before quoting a from-scratch corpus census.

B (informational, not blocking). The comment-line lazy codeAction row — §8.2's central piece of evidence for the "2.9×" gate-cost claim — is noisier than its own 1–20 ms/±20% tolerance band. Two independent QA reruns of the codeaction phase on the same 0.49.0 binary, minutes apart, gave means of 2.42 ms and 5.25 ms for this row (doc: 3.91 ms mean), a 2.2× swing between two back-to-back runs of the identical binary and harness — each individual run falls outside ±20% of the document's number, in opposite directions. The qualitative finding holds (0.49.0 consistently slower than 0.43.0 at this cursor: my 0.43.0 mean was 1.43 ms both times) and the average of my two 0.49.0 reruns (≈2.68×) lands close to the doc's claimed 2.9×, but a single three/four-try reading — which is what the document and the harness's default both take — is not reliable at this row's magnitude on this machine. Not a finding against the document's conclusion, but future rounds should take more tries (8–10) for any sub-5 ms row used as load-bearing evidence for a specific multiplier.

Verdict: PASS

Both findings are minor and non-blocking: finding A is a traceability gap with a substance-confirmed number, finding B is a reproducibility caveat that strengthens rather than undermines the document's own qualitative claim. Every row I re-ran landed inside §9's tolerance or is explained by machine noise the document already documents; the CLI outcome diff ("byte-identical formatter verdicts", "20 new unused-import findings, 17/2/1 split") reproduced exactly on three independent trees; the §8.2 mechanism claim checks out against the source; opentitan was never written to; the main tree carries only the dev's files; no guard kill occurred anywhere in this QA pass.

Review

2026-09-07 (lead). Accepted. Read the document end to end, the §2 table against take 3's, the perf README entry, the harness README and the QA log.

  • The round answers the question it was asked: 0.49.0 against 0.43.0 with the same client in the same hour, so the columns are comparable in a way take 3's could not be. The one-line reading (four things moved) is supported by the table, and §8.9's dismissal of the sub-millisecond rows is the right call on a desktop-loaded machine.
  • §8.2 verified in the source by me and by QA: inline_site and extract_site each re-parse the whole buffer on every codeAction (crates/vlog_refactor/src/inline/mod.rs:74, extract/mod.rs:83), called from inline_module.rs:51 and extract.rs:76, while the server already holds the document's tree. The fix is the shape §37.1 used and is filed for the owner's ruling in TODO's loop-3 list, not done here (this lane fixes nothing, by design).
  • §8.3 (the tail rename at 751 ms) is filed correctly as a cost of a correct answer; completion on the same surface being free points at rename's reference walk, which is where a future lane should look first.
  • The harness is the durable result: nine files, standard library only, phases named so take 5 can diff rows by name. The 500-line split was the right response to §58's size rule.
  • QA finding A (the header census untraceable) fixed by a traceability note in §6b naming the method and QA's independent count; finding B (the comment-line row noisier than its band) is already stated in the document's tolerance text and the multiplier holds across both QA reruns, so no change.
  • Deviations accepted: the busier machine (stated as the largest caveat, mitigated structurally), the six-file harness, the ANSI row measuring an ANSI header because the corpus has no other kind.

Docs applied at merge: perf README entry (the dev's), TODO §58 ticked, the §8.2 gate and §8.3 walk added to the loop-3 open items.