Repository navigation
perf(web): cut 100k-path tree render cost and served shell bytes - #127
Conversation
Derive the grant tree without a leaf object and child array per path, skip rebuilding the row key on unchanged presence frames, and strip comments from the generated shell.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Caution Review failedThe pull request is closed. WalkthroughThe build now transforms public HTML pages before writing them to Changes: Served HTML Shell
Browser Tree
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Merge Risk:
|
The 100,000-path listing render guard in
test/tree-view.test.tswas failing on this host at 5,548 ms against its 5,000 ms budget. The same listing is read on every room event, and the generated shell was carrying 32 KB of comments a browser throws away.This change derives the tree with one name index per directory and stores file children directly instead of allocating a leaf object and a child array for every path. A presence frame now compares the small row chrome and skips rebuilding the multi-megabyte rows key when nothing it draws changed, while still honoring the forced-rebuild sentinel. The build strips HTML comments and CSS comments inside
<style>from the generateddist/*.htmlonly; the source pages keep their comments for the page-contract tests.Proof:
npm run test:ci: 34.03 s, 896/897 tests, failingdraws the levels a person opened, not a row per pathat 5,548 ms / 5,000 ms. After: 898/898 pass.npm testalso 898/898 pass.HEADand candidategrantLevelsmodules side by side over the same 100,000-path array (9 runs each, garbage collection between runs): median 472 ms before, 426 ms after (9.7% less CPU), with byte-identical output maps.GrantTreeView.render()in the 100,000-path fixture: 5-7 ms CPU before, under 1 ms after.world.createdstayed 9 for the ceiling render and 0 for the presence frame.test/tree-view.test.ts:1601fails on the first candidate ('the row is still dimmed after the drag ended') and passes after the review fix.wc -c dist/index.html dist/404.html: 92,551 -> 60,599 B (-31,952 B, -34.5%) and 7,292 -> 6,979 B (-313 B). Totaldist/files: 18,797,338 -> 18,767,044 B.npm run typecheckpasses.scripts/ci-local.sh allpasses end to end, including the byte-reproducibledist/check and link check. Workspace contract check at the candidate commit: 4 comparisons, 0 drifted, 0 errors.Scope decisions:
src/bridge/andsrc/engine/are canonical copies checked againstvscode_client, so no optimization there was landed. The sidebar's per-pointer-move storage write and the eager engine import were investigated but left alone: the first has a test that requires one write per move, and the second needs a wider import refactor with no measured win in this change.Skipped checks: the live proof scripts need
SELVAGE_SELVAGEDand Chromium, and the container smoke needs Docker. Neither is part ofscripts/ci-local.sh all.Reviewed with review-loop: 2 rounds with opencode-go/hy4-flash-free. verdict: approved
Created with opencode-go/hy4-flash-free in Pi (T3 Code), including the read-only investigator and review subagents.
Summary by CodeRabbit