Repository navigation
perf: draw each frame of a fast table scroll 15% faster - #1302
Open
lukecotter wants to merge 4 commits into
Open
lukecotter wants to merge 4 commits into
lukecotter wants to merge 4 commits into
Conversation
A bar cell was five elements: a wrapper, the bar, a text wrapper, the value and the percent. A fast scroll draws every row again, so the browser restyled, laid out and painted all of them on each frame. The bar is now the wrapper's background, sized by an inline background-size. A bar cell is the wrapper, the value and the percent, and an Analysis row drops from 36 to 27 elements on average. On 40 full-window jumps in the Analysis grid at 4x CPU throttle, the median frame takes 30.1 ms (was 35.3): style 8.7 ms (was 10.2), layout 6.3 ms (was 7.5), paint 11.0 ms (was 12.1). A custom property for the width was slower: it inherits, so each change restyled the value and the percent too.
`share > 0` gives the same result as `value > 0 && total > 0`. The class names now match the markup, because the progress-bar element is gone. The tests cover a value above its total and a negative value, and count the elements per cell. They no longer check the find text, because the Call Tree column tests do that.
The share was rounded to a whole number and then shown with two decimals, so it always ended in .00: 12.5% showed as 13.00%. Other views show the same share as 12.50%.
Forced colours drop every background image, so the bars disappeared. The bar now keeps its image and takes the system highlight colour, and its text takes the system text colour.
This branch has not been deployed
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 bar cell in the tables was five elements: a wrapper, the bar, a text wrapper, the value and the percent. A fast scroll (scrollbar drag, Page Down, find) draws every row again, so the browser restyled, laid out and painted all of them on each frame. On 40 full-window jumps in the Analysis grid at 4× CPU throttle, the median frame took 35.3 ms, against a 16.7 ms budget.
The bar is now the wrapper's background, sized by an inline
background-size. A bar cell is three elements, and the median frame takes 30.1 ms (−15%). There is no visible change.mainEach value is a median of 5 runs. Each run used a new headless Chromium on the 19.7 MB sample log, with
mainand this branch in turn. Normal wheel scrolling was already inside the frame budget.🛠️ Changes made
bar()renders the wrapper, the value and the percent. The bar width is the inlinebackground-size, so a change restyles only the wrapper.--lana-grid-bar-filltoken holds the bar colour: the samecharts.orangeat 30%, as acolor-mix. The old bar usedopacity: 0.3on its own element.cells.test.tschecks the value and share text, the hairline for a share that rounds to 0, no bar for a zero value or total, and that find marks only the value.🧩 Type of change (check all applicable)
📷 Screenshots / gifs / video [optional]
N/A. There is no visual change. In the docs live demo, each value, percent and bar box has the same position as on
main(1 px of rounding at most). Screenshots match in the dark theme and in the light theme with a selected row.🔗 Related Issues
N/A
✅ Tests added?
pnpm lintpasses.pnpm exec jest --selectProjects log-viewer: 209 suites, 2,940 tests pass.pnpm exec playwright test --config=lana/test/playwright/playwright.config.web.ts: 2 tests pass. The new tests fail when the hairline minimum is removed, and when the find marker moves to the wrapper.📚 Docs updated?
🧪badge — see RELEASING.md)Anything else we need to know? [optional]
pnpm bench:griddoes not cover this change: its contender renders plain text cells, not bar cells.## [Unreleased]section toCHANGELOG.md. The PR that merges second needs a rebase that keeps both lines.