perf: budget lines for the ports' lazy chunks (per-app) #890

Closed
kayg wants to merge 1 commit from perf/ports-lazy-budgets into dev
Owner

Adds explicit lazy chunk budgets for the contacts, tables, pictures/embeds and rows ports, grouped by app/area. New or enlarged lazy chunks get measured Brotli size plus about 5%, rounded upward to 0.01 KB. The existing table bar allowance stays unchanged. Pickers emits no new names.

Contacts totals 30.15 KB, 0.15 KB above 30 KB; tables 13.38 KB; pictures/embeds 12.13 KB; rows' dedicated lazy helper 2.15 KB. Shared helpers and the existing idle-screens/Vim exceptions retain their allowances. Total JS is 433.41 KB, exactly the sum of all named chunk budgets. First-paint JS stays 240 KB and CSS stays 22.1 KB.

Validated on dev-01 using temporary local merges onto dev 41f2efa3: all five port stack tips and clean dev pass perf/web.sh --bundle-only --gate; all six bundle-gate regression tests pass. Per-stack measurements, commands and remaining out-of-scope failures are in the PR comment. No port code or branches changed; temporary merges were not pushed. Do not merge.

Adds explicit lazy chunk budgets for the contacts, tables, pictures/embeds and rows ports, grouped by app/area. New or enlarged lazy chunks get measured Brotli size plus about 5%, rounded upward to 0.01 KB. The existing table bar allowance stays unchanged. Pickers emits no new names. Contacts totals 30.15 KB, 0.15 KB above 30 KB; tables 13.38 KB; pictures/embeds 12.13 KB; rows' dedicated lazy helper 2.15 KB. Shared helpers and the existing idle-screens/Vim exceptions retain their allowances. Total JS is 433.41 KB, exactly the sum of all named chunk budgets. First-paint JS stays 240 KB and CSS stays 22.1 KB. Validated on dev-01 using temporary local merges onto dev `41f2efa3`: all five port stack tips and clean dev pass `perf/web.sh --bundle-only --gate`; all six bundle-gate regression tests pass. Per-stack measurements, commands and remaining out-of-scope failures are in the PR comment. No port code or branches changed; temporary merges were not pushed. Do not merge.
perf: budget the ports' lazy chunks per app
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
da0a44a07e
Author
Owner

dev-01 results for budget head da0a44a07e67cdc5fef86dee9f4924e43cad7c7c, base dev 41f2efa38. KB means 1024 bytes; Brotli quality 11. Each stack tip was merged separately onto origin/dev in a throwaway detached worktree. The merges were not pushed. Only perf/budgets.json is in this PR.

stack tip first JS / 240 first CSS / 22.1 total JS / 433.41 original gate exit proposed gate exit
clean dev 233.200 18.799 353.255 not rerun 0
#841 → #843 → #848 → #849 233.391 18.799 382.386 1 0
#845 → #854 233.701 18.933 366.610 1 0
#846 → #860 → #861 233.977 20.698 365.619 1 0
#853 226.852 18.352 348.342 0 0
#875 → #877 → #878 237.277 18.983 363.193 1 0
#876 (sharing, outside ports scope) 242.400 18.960 359.423 1 1

Source tips and temporary merge SHAs:

  • #841 → #843 → #848 → #849: source b431c8e594ef77fbc829ea0bb9cac1fc522edbb7, temporary merge 85a52759e4b2687fb3ed4f6941ce9aa36bce1359 (origin/port/contacts-merge).
  • #845 → #854: source c9bad2d45765667ee85723c2ab77fb46c4b681e2, temporary merge e482065ca1f2fc20fee6c6d8ed62753ed0f8c9b2 (origin/port/port-tables-2).
  • #846 → #860 → #861: source 495b4041716e1ff0928a8b1df3a0fb6db9b93296, temporary merge c66aeb0e376f38c7d904ae5dc263c4e0df9a4713 (origin/port/port-attachments-3).
  • #853: source 2b3f5001fef8a2c9c1c98c3990e4167d50d4af35, temporary merge 47f2d8a04c7112778e2ca09d98701984e90b615a (origin/port/port-pickers).
  • #875 → #877 → #878: source 1a263eb1f1bccd79c2a3e0e04d70c16c48d1d17b, temporary merge 21c86729dc3fb39cd3f5b48eaaf9950e44c01094 (origin/port/rows-drop).
  • #876 (sharing, outside ports scope): source 9a98a7f18fcb0d24baa6b9143b4d7a98d527e50b, temporary merge d5db4670d1a3b146fb5d714a8ae05f973d71ec95 (origin/review/sharing-pr3-review).

Per-app dedicated lazy chunks (shared runtime and shared idle screens counted separately):

app / area measured lazy total budget total
contacts 28.969 30.15
tables 12.582 13.38
attachments 11.542 12.13
rows 2.043 2.15
pickers no new chunk names no increase

Contacts is 0.15 KB above 30 KB. That is the only new app allowance slightly above 30 KB; the existing ContactsScreen 14.5 and TreeSection 3.25 limits were kept. All new lines use ceil(measured_KB * 1.05 * 100) / 100. Only the existing widget and PictureViewer lines were raised. The table bar limit is unchanged.

chunk measured budget
ContactsScreen (contacts) 14.158203 14.50
TreeSection (contacts) 3.051758 3.25
edits (contacts) 1.419922 1.50
cardmenu (contacts) 0.544922 0.58
Timeline (contacts) 0.777344 0.82
logic (contacts) 1.708984 1.80
names (contacts) 0.619141 0.66
card (contacts) 1.094727 1.15
TidySheet (contacts) 1.300781 1.37
MergeSheet (contacts) 2.105469 2.22
fix (contacts) 2.187500 2.30
widget (tables) 10.352539 10.88
table-bar.svelte (tables) 2.229492 2.50
attachments (attachments) 10.325195 10.85
PictureViewer (attachments) 1.216797 1.28
press (rows) 2.042969 2.15

The table stack emits exactly widget (grid/model/glue) and table-bar.svelte (actions): 12.582 KB measured together, rather than the earlier ~9 KB estimate. Pickers adds no new names; its shared idle-screens is 40.618 KB. Rows also uses the existing shared idle-screens (43.025 KB); only press needs a new line. The existing 50.5 KB idle-screens and 39 KB Vim exceptions are unchanged. All other named budgets are unchanged.

Cap arithmetic: core/runtime 240.50 + shared helpers 18.00 + shared screens/hints 52.85 + search 25.25 + contacts 30.15 + tables 13.38 + pictures/embeds 12.13 + rows 2.15 + Vim 39.00 = 433.41 KB. The gate verifies this equality. Unknown names still fail.

Original failures resolved by this PR: contacts had nine unknown names; tables exceeded widget 7.25; pictures/embeds had unknown attachments and PictureViewer above 1.1; rows had unknown press. Pickers already passed.

Remaining / historical failures:

  • #861 previously reported 240.136 KB JS against 240, and 22.739 KB CSS against 22.1. Those are #861’s responsibility; this PR changes neither first-paint limit. On the specifically requested merge onto current dev, #861 measures 233.977 / 20.698 and both first-paint gates pass. The older branch-only failure does not reproduce on this base.
  • #876 in the numbered range is a sharing follow-up, not a rows port. Measured separately for completeness. It still fails first-paint JS and index (242.400 KB > 240) and emits unbudgeted ShareSheet (2.186523 KB) and page-dim (0.122070 KB). No sharing or first-paint allowance was added in this ports-only PR.

Commands on dev-01 (all heavy commands used ~/bin/slot; disk was above 290 GB free):

export PATH=/nix/var/nix/profiles/default/bin:$PATH
cd ~/Developer/Worktrees/ports-budget-measure
# For each tip listed above, starting from dev 41f2efa3:
git reset --hard origin/dev
git merge --no-edit origin/<tip>
nix develop -c bash -c 'bun install --frozen-lockfile'
PERF_OUT=$HOME/ports-budget-results/<app> \
PERF_WORK=$HOME/ports-budget-results/<app>-work \
  nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate'

# Copy the proposed perf/budgets.json, then recheck each identical built bundle:
PERF_DIST=$HOME/ports-budget-results/<app>-work/dist \
PERF_OUT=$HOME/ports-budget-results/<app>-updated \
PERF_WORK=$HOME/ports-budget-results/check-work \
  nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate'

nix develop -c bash -c '~/bin/slot node --test apps/web/scripts/test/bundle-budget.test.mjs'
# 6 tests, 6 pass, 0 fail.

# Clean dev, with the proposed budgets, built afresh:
git reset --hard origin/dev
# copy proposed perf/budgets.json
PERF_OUT=$HOME/ports-budget-results/dev \
PERF_WORK=$HOME/ports-budget-results/dev-work \
  nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate'
# exit 0

Temporary conflict resolutions retained dev’s PullHint wiring while adding ContactsScreen (19 retry imports), or sharing’s share/shareSheet imports, and removed the obsolete TagPicker retry pattern for the pickers stack (18 retry imports). No behavior changes were included in the budget PR. Nix flake files were overlaid from origin/infra/nix-devshell only in the temporary VM worktree as the common brief directs. No UI/runtime tests were run for this budget-only change. Nothing merged.

dev-01 results for budget head `da0a44a07e67cdc5fef86dee9f4924e43cad7c7c`, base dev `41f2efa38`. KB means 1024 bytes; Brotli quality 11. Each stack tip was merged separately onto origin/dev in a throwaway detached worktree. The merges were not pushed. Only `perf/budgets.json` is in this PR. | stack tip | first JS / 240 | first CSS / 22.1 | total JS / 433.41 | original gate exit | proposed gate exit | |---|---:|---:|---:|---:|---:| | clean dev | 233.200 | 18.799 | 353.255 | not rerun | 0 | | #841 → #843 → #848 → #849 | 233.391 | 18.799 | 382.386 | 1 | 0 | | #845 → #854 | 233.701 | 18.933 | 366.610 | 1 | 0 | | #846 → #860 → #861 | 233.977 | 20.698 | 365.619 | 1 | 0 | | #853 | 226.852 | 18.352 | 348.342 | 0 | 0 | | #875 → #877 → #878 | 237.277 | 18.983 | 363.193 | 1 | 0 | | #876 (sharing, outside ports scope) | 242.400 | 18.960 | 359.423 | 1 | 1 | Source tips and temporary merge SHAs: - #841 → #843 → #848 → #849: source `b431c8e594ef77fbc829ea0bb9cac1fc522edbb7`, temporary merge `85a52759e4b2687fb3ed4f6941ce9aa36bce1359` (`origin/port/contacts-merge`). - #845 → #854: source `c9bad2d45765667ee85723c2ab77fb46c4b681e2`, temporary merge `e482065ca1f2fc20fee6c6d8ed62753ed0f8c9b2` (`origin/port/port-tables-2`). - #846 → #860 → #861: source `495b4041716e1ff0928a8b1df3a0fb6db9b93296`, temporary merge `c66aeb0e376f38c7d904ae5dc263c4e0df9a4713` (`origin/port/port-attachments-3`). - #853: source `2b3f5001fef8a2c9c1c98c3990e4167d50d4af35`, temporary merge `47f2d8a04c7112778e2ca09d98701984e90b615a` (`origin/port/port-pickers`). - #875 → #877 → #878: source `1a263eb1f1bccd79c2a3e0e04d70c16c48d1d17b`, temporary merge `21c86729dc3fb39cd3f5b48eaaf9950e44c01094` (`origin/port/rows-drop`). - #876 (sharing, outside ports scope): source `9a98a7f18fcb0d24baa6b9143b4d7a98d527e50b`, temporary merge `d5db4670d1a3b146fb5d714a8ae05f973d71ec95` (`origin/review/sharing-pr3-review`). Per-app dedicated lazy chunks (shared runtime and shared idle screens counted separately): | app / area | measured lazy total | budget total | |---|---:|---:| | contacts | 28.969 | 30.15 | | tables | 12.582 | 13.38 | | attachments | 11.542 | 12.13 | | rows | 2.043 | 2.15 | | pickers | no new chunk names | no increase | Contacts is 0.15 KB above 30 KB. That is the only new app allowance slightly above 30 KB; the existing ContactsScreen 14.5 and TreeSection 3.25 limits were kept. All new lines use `ceil(measured_KB * 1.05 * 100) / 100`. Only the existing widget and PictureViewer lines were raised. The table bar limit is unchanged. | chunk | measured | budget | |---|---:|---:| | `ContactsScreen` (contacts) | 14.158203 | 14.50 | | `TreeSection` (contacts) | 3.051758 | 3.25 | | `edits` (contacts) | 1.419922 | 1.50 | | `cardmenu` (contacts) | 0.544922 | 0.58 | | `Timeline` (contacts) | 0.777344 | 0.82 | | `logic` (contacts) | 1.708984 | 1.80 | | `names` (contacts) | 0.619141 | 0.66 | | `card` (contacts) | 1.094727 | 1.15 | | `TidySheet` (contacts) | 1.300781 | 1.37 | | `MergeSheet` (contacts) | 2.105469 | 2.22 | | `fix` (contacts) | 2.187500 | 2.30 | | `widget` (tables) | 10.352539 | 10.88 | | `table-bar.svelte` (tables) | 2.229492 | 2.50 | | `attachments` (attachments) | 10.325195 | 10.85 | | `PictureViewer` (attachments) | 1.216797 | 1.28 | | `press` (rows) | 2.042969 | 2.15 | The table stack emits exactly `widget` (grid/model/glue) and `table-bar.svelte` (actions): 12.582 KB measured together, rather than the earlier ~9 KB estimate. Pickers adds no new names; its shared idle-screens is 40.618 KB. Rows also uses the existing shared idle-screens (43.025 KB); only `press` needs a new line. The existing 50.5 KB idle-screens and 39 KB Vim exceptions are unchanged. All other named budgets are unchanged. Cap arithmetic: core/runtime 240.50 + shared helpers 18.00 + shared screens/hints 52.85 + search 25.25 + contacts 30.15 + tables 13.38 + pictures/embeds 12.13 + rows 2.15 + Vim 39.00 = **433.41 KB**. The gate verifies this equality. Unknown names still fail. Original failures resolved by this PR: contacts had nine unknown names; tables exceeded widget 7.25; pictures/embeds had unknown attachments and PictureViewer above 1.1; rows had unknown press. Pickers already passed. Remaining / historical failures: - #861 previously reported **240.136 KB JS** against 240, and **22.739 KB CSS** against 22.1. Those are #861’s responsibility; this PR changes neither first-paint limit. On the specifically requested merge onto current dev, #861 measures 233.977 / 20.698 and both first-paint gates pass. The older branch-only failure does not reproduce on this base. - #876 in the numbered range is a sharing follow-up, not a rows port. Measured separately for completeness. It still fails first-paint JS and index (242.400 KB > 240) and emits unbudgeted `ShareSheet` (2.186523 KB) and `page-dim` (0.122070 KB). No sharing or first-paint allowance was added in this ports-only PR. Commands on dev-01 (all heavy commands used `~/bin/slot`; disk was above 290 GB free): ```sh export PATH=/nix/var/nix/profiles/default/bin:$PATH cd ~/Developer/Worktrees/ports-budget-measure # For each tip listed above, starting from dev 41f2efa3: git reset --hard origin/dev git merge --no-edit origin/<tip> nix develop -c bash -c 'bun install --frozen-lockfile' PERF_OUT=$HOME/ports-budget-results/<app> \ PERF_WORK=$HOME/ports-budget-results/<app>-work \ nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate' # Copy the proposed perf/budgets.json, then recheck each identical built bundle: PERF_DIST=$HOME/ports-budget-results/<app>-work/dist \ PERF_OUT=$HOME/ports-budget-results/<app>-updated \ PERF_WORK=$HOME/ports-budget-results/check-work \ nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate' nix develop -c bash -c '~/bin/slot node --test apps/web/scripts/test/bundle-budget.test.mjs' # 6 tests, 6 pass, 0 fail. # Clean dev, with the proposed budgets, built afresh: git reset --hard origin/dev # copy proposed perf/budgets.json PERF_OUT=$HOME/ports-budget-results/dev \ PERF_WORK=$HOME/ports-budget-results/dev-work \ nix develop -c bash -c '~/bin/slot perf/web.sh --bundle-only --gate' # exit 0 ``` Temporary conflict resolutions retained dev’s PullHint wiring while adding ContactsScreen (19 retry imports), or sharing’s share/shareSheet imports, and removed the obsolete TagPicker retry pattern for the pickers stack (18 retry imports). No behavior changes were included in the budget PR. Nix flake files were overlaid from origin/infra/nix-devshell only in the temporary VM worktree as the common brief directs. No UI/runtime tests were run for this budget-only change. Nothing merged.
Author
Owner

housekeeping #1009: needs-decision.

Per-port budget snapshot uses the old entry/chunk layout (including index 240 and old widget/idle values). Dev now has separate code parsers and picker chunks. Preserve proposed per-app allocations for fresh bundle measurements; replaying the snapshot would erase newer caps.

original head: da0a44a07e67cdc5fef86dee9f4924e43cad7c7c. against dev cd7f84432febfc63b788fbb9b9f9950452982d74, git cherry reports 1 unmatched and 0 equivalent patches. the landing audit lists each candidate missing commit and stable patch match in pr-890.md; unmatched patches can include superseded behavior.

left open, source branch unchanged. no rebase or new test claim for this decision lane.

housekeeping #1009: needs-decision. Per-port budget snapshot uses the old entry/chunk layout (including index 240 and old widget/idle values). Dev now has separate code parsers and picker chunks. Preserve proposed per-app allocations for fresh bundle measurements; replaying the snapshot would erase newer caps. original head: `da0a44a07e67cdc5fef86dee9f4924e43cad7c7c`. against dev `cd7f84432febfc63b788fbb9b9f9950452982d74`, git cherry reports 1 unmatched and 0 equivalent patches. the [landing audit](https://git.kayg.org/attachments/fe3c09dc-dea3-47a0-92e2-b44a777083e5) lists each candidate missing commit and stable patch match in `pr-890.md`; unmatched patches can include superseded behavior. left open, source branch unchanged. no rebase or new test claim for this decision lane.
Author
Owner

Closing per the 11-10 orchestrator decision; current dev budgets supersede this snapshot.

Closing per the 11-10 orchestrator decision; current dev budgets supersede this snapshot.
kayg closed this pull request 2026-11-10 16:02:21 +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!890
No description provided.