Web bundle: recover deferred headroom (D188) #210

Closed
opened 2026-10-13 18:38:05 +00:00 by kayg · 2 comments
Owner

Deferred JavaScript is at brotli 44,807 / 45,056 B and gzip 50,749 / 51,200 B on origin/dev (1f637cbb), which blocks more canvas work. D188 forbids raising budgets, so this issue recovers headroom without changing behaviour or visuals. Branch web-budget-headroom (worktree .worktrees/web-budget-headroom), base 1f637cbb.

Baseline (origin/dev, TRACER_DIST=... bun run build.ts then transfer-budget.ts):

  • critical identity=952686 gzip=295329/307200 brotli=245814/256000
  • deferred identity=142372 gzip=50749/51200 brotli=44807/45056
  • on-demand identity=191298 gzip=74742 brotli=66427 (largest chunk gzip 15946/20480, brotli 14176/18432)

Top 20 deferred contributors (bytes in the minified output; brotli is the chunk's brotli size shared out in proportion, so an estimate):

# module min B ~br B
1 src/canvas/windows/lifecycle.ts 10464 3157
2 src/canvas/views/world.ts 10287 3104
3 packages/ui/src/host-icons.ts (six platform marks; real brotli of the path data alone is 2,749) 7423 2536
4 src/canvas/camera/gestures.ts 6848 2066
5 src/canvas/sessions/live.ts 6275 1893
6 packages/ui/src/window-resize.ts 4980 1702
7 src/canvas/camera/camera.ts 4736 1618
8 src/canvas/toolbar/palette.ts 4651 1403
9 src/canvas/product.ts 4564 1377
10 src/canvas/windows/frame.ts 4394 1326
11 src/canvas/create.ts 4327 1306
12 src/canvas/toolbar/shortcuts.ts 3966 1197
13 src/canvas/model/document.ts 3946 1191
14 src/canvas/toolbar/row.ts 3613 1090
15 src/canvas/views/icons.ts 3414 1166
16 src/canvas/windows/move.ts 3300 996
17 packages/ui/src/inbox.ts 3295 1126
18 packages/ui/src/connection-indicator.ts 3172 1084
19 src/canvas/toolbar/pill.ts 3127 943
20 packages/ui/src/window-card.ts 3125 1068

Finding: only one deferred module draws a host mark (views/icons.ts, the window pill), yet all six platform marks ship with it. Plan: split the artwork per platform into on-demand modules fetched when a host of that platform is first seen.

Deferred JavaScript is at brotli 44,807 / 45,056 B and gzip 50,749 / 51,200 B on origin/dev (1f637cbb), which blocks more canvas work. D188 forbids raising budgets, so this issue recovers headroom without changing behaviour or visuals. Branch `web-budget-headroom` (worktree .worktrees/web-budget-headroom), base 1f637cbb. Baseline (origin/dev, `TRACER_DIST=... bun run build.ts` then `transfer-budget.ts`): - critical identity=952686 gzip=295329/307200 brotli=245814/256000 - deferred identity=142372 gzip=50749/51200 brotli=44807/45056 - on-demand identity=191298 gzip=74742 brotli=66427 (largest chunk gzip 15946/20480, brotli 14176/18432) Top 20 deferred contributors (bytes in the minified output; brotli is the chunk's brotli size shared out in proportion, so an estimate): | # | module | min B | ~br B | |---|--------|------:|------:| | 1 | src/canvas/windows/lifecycle.ts | 10464 | 3157 | | 2 | src/canvas/views/world.ts | 10287 | 3104 | | 3 | packages/ui/src/host-icons.ts (six platform marks; real brotli of the path data alone is 2,749) | 7423 | 2536 | | 4 | src/canvas/camera/gestures.ts | 6848 | 2066 | | 5 | src/canvas/sessions/live.ts | 6275 | 1893 | | 6 | packages/ui/src/window-resize.ts | 4980 | 1702 | | 7 | src/canvas/camera/camera.ts | 4736 | 1618 | | 8 | src/canvas/toolbar/palette.ts | 4651 | 1403 | | 9 | src/canvas/product.ts | 4564 | 1377 | | 10 | src/canvas/windows/frame.ts | 4394 | 1326 | | 11 | src/canvas/create.ts | 4327 | 1306 | | 12 | src/canvas/toolbar/shortcuts.ts | 3966 | 1197 | | 13 | src/canvas/model/document.ts | 3946 | 1191 | | 14 | src/canvas/toolbar/row.ts | 3613 | 1090 | | 15 | src/canvas/views/icons.ts | 3414 | 1166 | | 16 | src/canvas/windows/move.ts | 3300 | 996 | | 17 | packages/ui/src/inbox.ts | 3295 | 1126 | | 18 | packages/ui/src/connection-indicator.ts | 3172 | 1084 | | 19 | src/canvas/toolbar/pill.ts | 3127 | 943 | | 20 | packages/ui/src/window-card.ts | 3125 | 1068 | Finding: only one deferred module draws a host mark (views/icons.ts, the window pill), yet all six platform marks ship with it. Plan: split the artwork per platform into on-demand modules fetched when a host of that platform is first seen.
Author
Owner

Finished. Branch web-budget-headroom, head 59391585 (base 1f637cbb), pushed, not merged.

One commit: each platform's host mark (6.9 KB of path data) is now its own *.on-demand.ts module, fetched when a host of that platform is first seen (ensureHostMarks, called from the host list and the embedded host's facts). A mark drawn before its module arrives is the machine glyph with data-os, healed in place. Loaded markup is byte-identical to before. Budgets unchanged.

class before gzip / brotli after gzip / brotli limit
critical 295,329 / 245,814 295,408 / 245,683 307,200 / 256,000
deferred 50,749 / 44,807 47,688 / 42,272 51,200 / 45,056
on-demand (total, not limited) 74,742 / 66,427 78,207 / 69,657 per chunk 20,480 / 18,432
on-demand largest chunk 15,946 / 14,176 15,946 / 14,196 20,480 / 18,432

Deferred headroom: brotli 249 -> 2,784 B, gzip 451 -> 3,512 B. A person with one platform pays only that platform's mark (about 0.4-1.1 KB br) instead of all six.

Tests: bun run check clean; bun test on unit tests (chunk-classes, browser-build, precompress, etc.) pass except 3 that also fail on base (needs dist/ and a Rust/TS frame test); Playwright hosts-from-server, details, mesh, sessions-canvas, addhost-wizard, machine-sections, hosts-new-window-review, hosts-removal-review, canvas: 50 passed. transfer-budget.ts passes. Not measured on the perf VM: the critical path is untouched (critical brotli went down 131 B), so no first-paint or interaction numbers were taken.

Finished. Branch `web-budget-headroom`, head 59391585 (base 1f637cbb), pushed, not merged. One commit: each platform's host mark (6.9 KB of path data) is now its own `*.on-demand.ts` module, fetched when a host of that platform is first seen (`ensureHostMarks`, called from the host list and the embedded host's facts). A mark drawn before its module arrives is the machine glyph with `data-os`, healed in place. Loaded markup is byte-identical to before. Budgets unchanged. | class | before gzip / brotli | after gzip / brotli | limit | |---|---|---|---| | critical | 295,329 / 245,814 | 295,408 / 245,683 | 307,200 / 256,000 | | deferred | 50,749 / 44,807 | 47,688 / 42,272 | 51,200 / 45,056 | | on-demand (total, not limited) | 74,742 / 66,427 | 78,207 / 69,657 | per chunk 20,480 / 18,432 | | on-demand largest chunk | 15,946 / 14,176 | 15,946 / 14,196 | 20,480 / 18,432 | Deferred headroom: brotli 249 -> 2,784 B, gzip 451 -> 3,512 B. A person with one platform pays only that platform's mark (about 0.4-1.1 KB br) instead of all six. Tests: `bun run check` clean; `bun test` on unit tests (chunk-classes, browser-build, precompress, etc.) pass except 3 that also fail on base (needs dist/ and a Rust/TS frame test); Playwright hosts-from-server, details, mesh, sessions-canvas, addhost-wizard, machine-sections, hosts-new-window-review, hosts-removal-review, canvas: 50 passed. `transfer-budget.ts` passes. Not measured on the perf VM: the critical path is untouched (critical brotli went down 131 B), so no first-paint or interaction numbers were taken.
Author
Owner

Closed by the orchestrator during the 2026-10-28 handover (#254), on the owner's request to close finished issues. Evidence: Merged web-budget-headroom (804ac0e85) in dev: deferred brotli 44,807 to 42,272 of 45,056. Reopen if anything is still missing.

Closed by the orchestrator during the 2026-10-28 handover (#254), on the owner's request to close finished issues. Evidence: Merged web-budget-headroom (804ac0e85) in dev: deferred brotli 44,807 to 42,272 of 45,056. Reopen if anything is still missing.
kayg closed this issue 2026-10-28 17:53:18 +00:00
Sign in to join this conversation.
No labels
launch-qa
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/infraternal#210
No description provided.