Repository navigation
perf: switch back to a tab up to 35% faster - #1301
Closed
lukecotter wants to merge 1 commit into
Closed
lukecotter wants to merge 1 commit into
lukecotter wants to merge 1 commit into
Conversation
A hidden tab used display: none, so the browser threw away its layout and built it again on every switch back. content-visibility: hidden keeps the layout and skips its rendering work while the tab is hidden. At 4x CPU throttle on a 100 MB log, a switch back to Analysis takes 44 ms (was 57), Database 45 ms (was 68) and Timeline 50 ms (was 55). The renderer holds about 6 MB more, the same on a 19.7 MB log. A hidden tab still takes no space and no focus. A new web e2e test checks both.
3 of 15 tasks
Collaborator
Author
|
Closing. A hidden tab now keeps its size, and three parts of the viewer use size 0 to find a hidden tab:
The gain is 13–23 ms per tab switch at 4x CPU throttle, for about 6 MB more memory. That does not justify changes in those three modules. |
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.
📝 PR Overview
A hidden tab used
display: none. The browser threw away the tab's layout and laid it out again on each switch back. On a 100 MB log at 4× CPU throttle, a switch back to Analysis or Database took 57–68 ms.A hidden tab now uses
content-visibility: hidden. It keeps its layout and does no rendering work while it is hidden. A switch back is up to 35% faster, for about 6 MB more renderer memory.Each value is a median of 4 runs (19.7 MB log) or 3 runs (100 MB log). Each run used a new headless Chromium, with
mainand this branch in turn.🛠️ Changes made
vscode-tab-panel[hidden]keepsdisplay: blockwithcontent-visibility: hidden, so the tab keeps its layout.flex: nonestops a hidden panel from taking a share of the tab area. Without it, each hidden panel took 131.5 px.visibility: hiddentakes a hidden panel out of the tab order and the accessibility tree. Each panel hastabindex="0".🧩 Type of change (check all applicable)
📷 Screenshots / gifs / video [optional]
N/A. There is no visual change.
🔗 Related Issues
N/A
✅ Tests added?
pnpm lintpasses.pnpm exec jest --selectProjects log-viewer: 208 suites, 2,936 tests pass.pnpm exec playwright test --config=lana/test/playwright/playwright.config.web.ts: 3 tests pass.Checked by hand in the docs live demo, in the light and dark themes:
📚 Docs updated?
🧪badge — see RELEASING.md)Anything else we need to know? [optional]
main). Total renderer memory on the 100 MB log goes from 413 MB to 419 MB (+1.4%).main, not worse."DOM"tolana/test/playwright/tsconfig.jsonwould fix that.