perf(core): batch menu viewport measurements - #1823
Merged
Merged
Conversation
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (10)
Players (5)
Skins (30)
UI Components (39)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (9)
Skins (27)
UI Components (33)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (68)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (11)
📦 @videojs/spf — no changesEntries (4)
ℹ️ How to interpretJS sizes are initial static graph totals (minified + brotli). Lazy dynamic chunks are shown separately when present.
Run |
stow1x
approved these changes
Jul 13, 2026
mihar-22
approved these changes
Jul 16, 2026
Merged
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.
Closes #1821
Summary
Opening an ejected light-DOM settings menu previously repeated root sizing for every initially hidden submenu and interleaved per-view style writes with layout reads. That work grew with the number of mounted panels and became expensive against a stylesheet-heavy host page.
This change skips the initial-hidden sync, batches the root and entering or exiting view measurements, and restores temporary styles without a final forced layout. The CSS transition barriers remain so submenu animation behavior is unchanged.
The meaningful changes are concentrated in three areas:
measureViews()(line 167) — the main performance change. It applies measurement styles to all involved views before reading, does at most one constrained-width pass, and restores styles without a final layout flush.Entering/exiting transition setup (line 257) — entering now measures root + submenu together; exiting does the same at line 311 (line 311). The forceLayout() calls here remain intentional CSS transition barriers.
Hidden lifecycle guard (line 415) — lines 426–430 skip root measurement for initially hidden panels, while retaining the resync when a previously visible panel becomes hidden.
Most changes above line 167 are private-name cleanup, not behavior.
Benchmarks
Reported beta.25 production baseline
Current light-DOM Tailwind v4 fixture
*Measured as elapsed time inside the instrumented
getBoundingClientRect()calls, with Tailwind v4 browser CDN CSS and 24 styled host-page cards. This is a controlled local approximation, not a DevTools Layout-event total from the reporter production stylesheet. It confirms the important property: opening cost is constant as mounted panel count grows.Changes
Verification
A production reprofile against the reporter host stylesheet remains the final wall-clock validation.
Testing
pnpm -F @videojs/core test src/dom/ui/menu/tests/menu-viewport-transition.test.tspnpm -F @videojs/core buildpnpm exec biome check packages/core/src/dom/ui/menu/menu-viewport-transition.ts packages/core/src/dom/ui/menu/tests/menu-viewport-transition.test.ts