perf: first-paint diet (-983 B brotli) #906

Closed
kayg wants to merge 0 commits from perf/first-paint-diet into dev
Owner

First-paint diet: gives back room for the #902/#903/#904 ports (+691 B together).

Change (1 commit, 809a33c2): leave y-codemirror.next's unused remote-cursor module out of the build. yCollab only uses it with an awareness; the editor passes null. Build-time empty stand-in (apps/web/scripts/no-remote-selections-plugin.ts). No behaviour or look change.

before (dev 41f2efa3) after delta
first-paint JS brotli 238797 B 237814 B -983 B
first-paint JS raw 845550 841512 -4038
first-paint CSS brotli 19250 19250 0
all JS brotli 322948 321904 -1044

Net after the three ports: about -292 B vs today's dev. It is 41 B short of 1 KiB (1024 B). I looked at the rest of the first-paint chunk (per-module attribution from a source map) and found nothing else that is safe: unused exports are already shaken out, the remaining candidates are on hot or startup paths (wipe.ts, autocomplete, rows), and I measured and dropped: discloseVersion:false (-5 B), removing unused icons (+140 B, brotli got worse), de-duplicating CSS prefixes (-22 B).

Gates

  • Bundle gate: perf/web.sh --bundle-only --gate ok (first JS 232.24 KiB vs 240, first CSS 18.80 vs 22.1).
  • Unit: apps/web 96, packages/editor 511, ui primitives 55 pass; web lint ok.
  • Nothing moved to lazy loading, so no lazy specs; I ran e2e/editor.spec.ts --repeat-each=3 on chromium-1440/390 and webkit-1440/390: all pass (some skipped by project).
  • Perf (perf-02, locks held on perf-01 and perf-02, Chromium 4x CPU, 10k Home, 8 interleaved rounds of dev / this PR / dev-control, 24 cold runs each, 0 failures; localhost server, so no network time):
metric (ms) dev p50 / mean this PR p50 / mean dev-vs-dev control p50 / mean
cold FCP 814 / 811.5 820 / 807.0 812 / 799.5
cold note painted 1023.5 / 1018.5 1038.7 / 1018.6 1024.3 / 1006.1
cold TTI 1884.8 / 1873.2 1880.5 / 1884.5 1876.7 / 1856.7
cold CPU 1465 / 1468 1474 / 1451 1470 / 1438
warm note 515.2 / 593.1 514.5 / 582.3 517.0 / 584.3

FCP is flat within the dev-vs-dev noise (about ±10 ms): mean 4.5 ms better, p50 6 ms worse, control differs by the same amount. A 1 KB brotli saving can't show on localhost.

Decision: no further risky moves just to reach 1024 B.

First-paint diet: gives back room for the #902/#903/#904 ports (+691 B together). **Change (1 commit, 809a33c2):** leave y-codemirror.next's unused remote-cursor module out of the build. `yCollab` only uses it with an awareness; the editor passes `null`. Build-time empty stand-in (`apps/web/scripts/no-remote-selections-plugin.ts`). No behaviour or look change. | | before (dev 41f2efa3) | after | delta | |---|---|---|---| | first-paint JS brotli | 238797 B | 237814 B | **-983 B** | | first-paint JS raw | 845550 | 841512 | -4038 | | first-paint CSS brotli | 19250 | 19250 | 0 | | all JS brotli | 322948 | 321904 | -1044 | Net after the three ports: about -292 B vs today's dev. It is 41 B short of 1 KiB (1024 B). I looked at the rest of the first-paint chunk (per-module attribution from a source map) and found nothing else that is safe: unused exports are already shaken out, the remaining candidates are on hot or startup paths (wipe.ts, autocomplete, rows), and I measured and dropped: `discloseVersion:false` (-5 B), removing unused icons (+140 B, brotli got worse), de-duplicating CSS prefixes (-22 B). **Gates** - Bundle gate: `perf/web.sh --bundle-only --gate` ok (first JS 232.24 KiB vs 240, first CSS 18.80 vs 22.1). - Unit: apps/web 96, packages/editor 511, ui primitives 55 pass; web lint ok. - Nothing moved to lazy loading, so no lazy specs; I ran `e2e/editor.spec.ts --repeat-each=3` on chromium-1440/390 and webkit-1440/390: all pass (some skipped by project). - Perf (perf-02, locks held on perf-01 and perf-02, Chromium 4x CPU, 10k Home, 8 interleaved rounds of dev / this PR / dev-control, 24 cold runs each, 0 failures; localhost server, so no network time): | metric (ms) | dev p50 / mean | this PR p50 / mean | dev-vs-dev control p50 / mean | |---|---|---|---| | cold FCP | 814 / 811.5 | 820 / 807.0 | 812 / 799.5 | | cold note painted | 1023.5 / 1018.5 | 1038.7 / 1018.6 | 1024.3 / 1006.1 | | cold TTI | 1884.8 / 1873.2 | 1880.5 / 1884.5 | 1876.7 / 1856.7 | | cold CPU | 1465 / 1468 | 1474 / 1451 | 1470 / 1438 | | warm note | 515.2 / 593.1 | 514.5 / 582.3 | 517.0 / 584.3 | FCP is flat within the dev-vs-dev noise (about ±10 ms): mean 4.5 ms better, p50 6 ms worse, control differs by the same amount. A 1 KB brotli saving can't show on localhost. Decision: no further risky moves just to reach 1024 B.
perf(web): leave unused remote-cursor code out of first paint (-983 B brotli)
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
809a33c2b4
yCollab only uses y-codemirror.next remote selections when it is given an
awareness, and the editor always passes null. The module still shipped.
A build-time empty stand-in drops it; yCollab's own import keeps working.

first-paint JS: brotli 238797 -> 237814 B (-983), raw 845550 -> 841512 B (-4038)
first-paint CSS: unchanged (19250 B brotli)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Owner

merged into dev as 12103f1c97

merged into dev as 12103f1c973f1e810dd4a9a3bff5a705514d70b0
kayg closed this pull request 2026-11-05 23:23:40 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!906
No description provided.