extension: lazy-load rare content-script UI - #422
Closed
spencerc99 wants to merge 4 commits into
Closed
Conversation
Deploying we-were-online-website with
|
| Latest commit: |
59951aa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fcd71be5.we-were-online-website.pages.dev |
| Branch Preview URL: | https://cx-lazy-content-ui.we-were-online-website.pages.dev |
commit: |
Owner
Author
Code reviewNo issues found. Checked for bugs and project-instruction compliance. |
# Conflicts: # extension/src/entrypoints/content.ts
Deploying playhtml with
|
| Latest commit: |
59951aa
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://57d0d689.playhtml.pages.dev |
| Branch Preview URL: | https://cx-lazy-content-ui.playhtml.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Content-script size
Measured from same-machine production Chrome MV3 builds of current main (
769bba1c) and this branch (59951aa1):The on-demand
content-page-ui.jsartifact is 340,207 B raw, 107,710 B gzip, and 92,587 B Brotli. This trades total package bytes for less code parsed and initialized on every supported page. Site-specific React features still leave some React code in the eager content bundle; broader feature splitting is outside this focused change.Collector-ready startup
I ran 15 alternating same-machine pairs in headless Chrome. Every run used a fresh profile, started and seeded the extension worker before timing, navigated to the same local no-script page, and stopped when cursor, navigation, viewport, and keyboard collectors all reported enabled. The rare UI script was not requested during startup in any run.
The aggregate wall-time mean changed from 99.310 ms to 96.988 ms (-2.322 ms), but the run-to-run range is much wider than that difference. This PR therefore does not claim a meaningful wall-clock page-load improvement. It does show a small reduction in renderer startup work and a consistent roughly 100 KB reduction in startup heap while all collectors remain ready.
Local raw results:
/private/tmp/playhtml-extension-startup-latest-main-15/startup-summary.json(not committed).Built UI validation
The benchmark exercised the real production MV3 build after collector readiness:
content-page-ui.jswas absent from ordinary startup requestscontent-page-ui.jsrequested only when the overlay was openedThis validation runs headlessly so it does not steal focus or interrupt desktop use.
Verification
bun run build-packagesbun run test:extension: 140 files and 896 tests passedbun run check:extensionbun run smoke:extension: service worker, content script, and popup passed in isolated headless Chromiumbun run perf:extension:startup -- --extension main:<build> --extension pr:<build> --runs 15 --validate-ui prOpen-PR overlap was checked again before push. PR #400 also touches the Shadow DOM helper and historical overlay for dark mode, but it does not duplicate this loading-boundary change; no other open PR targets content-script startup.
No screenshots: visible UI behavior is unchanged. No
extension/PENDING.mdentry: this is internal performance work rather than a user-facing workflow change. No package docs, starter templates, or changeset are needed because published package APIs are unchanged.