Repository navigation
Commit 35440e4
perf: keep the TUI off the status line render path (sirmalloc#575)
Claude Code re-runs this binary every couple of seconds for as long as a
session is open, so module load time is paid continuously rather than once.
src/ccstatusline.ts imports runTUI statically, which pulls ink, React and
yoga-layout into the render path even though rendering never touches them.
Making that import dynamic is not enough on its own: --outfile cannot split,
so the whole graph still gets parsed. Building with --splitting moves the TUI
into its own chunk and shrinks the entry from 3.34 MB to 21 KB.
Measured on an M-series Mac, 20 runs per data point, real payload piped in:
before 238, 237, 238 ms/render
after 226, 222, 220 ms/render
That is roughly 7%, and the rendered output is byte-identical. The
interactive TUI was smoke-tested under a pty and behaves the same.
scripts/replace-version.ts had to change too: with splitting the
__PACKAGE_VERSION__ placeholder lands in a chunk rather than in
dist/ccstatusline.js, so patching only the entry would have silently
shipped an unreplaced placeholder. It now patches every emitted script and
fails loudly when it finds none.
Packaging is unaffected: files is already dist/, and bin/main/exports keep
pointing at dist/ccstatusline.js. Verified the built output runs under node
as well as bun.
Assisted-by: claude:claude-opus-5
Co-authored-by: Matthew Breedlove <[email protected]>1 parent 05554cd commit 35440e4
3 files changed
Lines changed: 27 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
24 | 34 | | |
25 | | - | |
26 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | | - | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
353 | 352 | | |
354 | 353 | | |
355 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
356 | 360 | | |
357 | 361 | | |
358 | 362 | | |
| |||
0 commit comments