Perf take 4 (§58): 0.49.0 vs 0.43.0 on opentitan — §46's didOpen fix 14× in the release build, the eager codeAction path 2×, the tail rename at 11×, the index +14%; harness committed in tools/perf/; findings filed for loop 3
ci / checks (push) Successful in 59s
ci / corpus (push) Successful in 33s

This commit is contained in:
lucio committed 2026-09-07 04:01:29 -05:00
1 parent 414d501847
commit d10e57aa6e
19 files changed
+2999 -9

No files matched your search

+85
View File
@@ -1109,3 +1109,88 @@ 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`.
### 2026-09-07 — take 4
TODO §58. **0.49.0 against 0.43.0** on opentitan `0098135264`, both binaries
measured in the same hour with the same client. Full document:
[`../performance_take4.md`](../performance_take4.md) (§0–§10). Feature
README: `docs/features/performance-take4/README.md`.
**The harness is now in the repository.** Take 2's, take 3's and take 1's
clients all lived in a scratch directory and all three are gone — take 3's
numbers had to be re-derived from take 2's prose. Take 4's lives in
`tools/perf/` (`lspclient.py`, `sites.py`, `bench.py`, `sweep.sh`,
`sweeptable.py`, `outcomes.sh`, `README.md`; Python 3 standard library only,
runs from a clean checkout). Take 5 reuses it. Sites are resolved from the
file text at run time, and the new offer sites were *found* with a `probe`
phase rather than guessed.
**Credits — what got faster.**
| | 0.43.0 | 0.49.0 | credit |
|---|---:|---:|---|
| `didOpen pinmux_reg_top.sv` (42 192 L) → next request | 1 605 / 1 604 / 1 611 ms | **112 / 131 / 128 ms** | **§46**, **14×** |
| `didOpen spi_device.sv` → next request | 98.7 / 75.2 / 99.5 ms | **15.5 / 13.8 / 15.1 ms** | §46, 6× |
| `didOpen aes_core.sv` → next request | 42.6 / 63.0 / 63.1 ms | **11.0 / 4.0 / 10.4 ms** | §46, 7× |
| a `didOpen` of an in-scope file at the default scope | 33–69 ms | **5–21 ms** | §46 — take 3's §8.4 **closed** |
| `completion` after an instance head + `.` | 24 items, 0.52–0.66 ms | **26 items, 0.45–0.53 ms** | §49, free |
| `rename` through an instance tail | 1 file, tail unedited | **2 files, tail edited** | §49, correctness (but see below) |
The 2026-09-05 entry above took its §46 numbers with temporary timings; **the
release build confirms them at the same magnitude**, which was the point of
this round's `didopen` phase.
**Filed findings** (in `performance_take4.md` §8; nothing was fixed here):
- **§8.2 (medium)** — the *lazy* `codeAction` offer costs 2–5 ms more at every
cursor, offered or not: a plain comment line, where **zero** actions are
offered on either binary, went 1.12–1.32 → 3.18–3.84 ms (2.9×), and the
`definition` pipelined behind a `codeAction` went 3.3–7.3 → 11.2–15.9 ms.
The mechanism is the new offers' gates (`inline_site`, `extract_site`) each
parsing the cursor's buffer on every cursor move. Still inside a frame; the
margin is gone.
- **§8.3 (low–medium)** — §49's tail rename is **11.3×** a same-file rename:
751 ms for two edited files against 66 ms for one. The correctness is right;
the cost freezes the serial queue for three quarters of a second.
- **§8.4 (low)** — `check --select error,warning,style` is 1.27× slower on
`hw/ip` (0.45 → 0.57 s). 0.48.0's new `unused-import` rule explains part of
it; `check` with the *default* rules did **not** move, so take 3's §8.5 has
stopped accumulating on the default path.
- **§8.5 (low)** — two instance-head tails on this corpus do not resolve
(`pwrmgr.sv` 178:10 inside a `` ` ``-macro argument; `pinmux.sv` 687:40).
Filed as a question, not a defect claim.
- **§8.6 (watch)** — the index is +13.7% on disk (39.0 → 44.3 MB) and
+12.6/+15.1% resident (482 → 542 MB cold, 509 → 586 MB warm), which is
`FACTS_FORMAT` 18 → 19 and is proportionate.
**Reported, not re-filed:** the eager `codeAction` path (a client without
`codeAction.resolveSupport`) is **1.95–2.07× dearer** at every fan-out —
243 → 470 ms at 128 files. The owner ruled it a non-hot path on 2026-09-05, so
take 4 reports the number and does not file it again.
**Outcome diff, 0.43.0 → 0.49.0** (`format --check --no-cache`, `check`,
`check --select …` over the same five trees): `format --check` and default
`check` are **byte-identical on all five trees** — §54's grammar additions
change no per-file verdict on this corpus, and §38's fixes stay fixed. The
only change anywhere is **20 new `unused-import` style findings** (`hw/ip`
+17, `hw/top_earlgrey/ip` +2, `hw/top_darjeeling/ip` +1), all from the rule
0.48.0 added. No violation disappeared. Nothing is unexplained.
**Two corpus facts worth remembering.** Opentitan has **zero** non-ANSI module
headers (all 1 311 headers scanned), so §51's `convert to ANSI` has no site
here at all. And take 3's "the lightbulb is almost never lit" no longer
describes this corpus: a 205-file, 2 440-position census at 0.49.0 finds
`extract selection` offered at **89%** of positions and `inline` at **11%**,
against exactly **one** port-refactoring offer — the same `aes_wrap.sv` 78:2
take 3 found.
**Caveat, stated because it is the largest one in the document.** The machine
ran a live desktop session throughout (WindowServer 45–51%, load average
3.7–7.1); take 3 measured at load 2–4. The transport floor moved 4× between
two sessions of the same client minutes apart. The mitigation is structural —
both binaries were measured alternating within the hour with one client — and
every conclusion above is a 0.49.0-vs-0.43.0 pair from that window. Nothing
under 0.5 ms is read. No guard kill; the largest resident set anything reached
was 588 MB, 7% of the 8 GB limit. The opentitan checkout was never written and
its `git status --porcelain` was checked after every phase.