Repository navigation
perf: improve grid column group auto-width performance - #5122
Merged
web-padawan merged 2 commits intoDec 16, 2022
Merged
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
sissbruecker
marked this pull request as ready for review
December 16, 2022 13:16
tomivirkki
approved these changes
Dec 16, 2022
web-padawan
approved these changes
Dec 16, 2022
web-padawan
deleted the
perf/improve_grid_column_group_auto_width_performance
branch
December 16, 2022 16:54
vaadin-bot
pushed a commit
that referenced
this pull request
Dec 16, 2022
web-padawan
pushed a commit
that referenced
this pull request
Dec 16, 2022
Collaborator
|
This ticket/PR has been released with Vaadin 24.0.0.alpha7 and is also targeting the upcoming stable 24.0.0 version. |
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.








Description
When using
auto-sizein combination with column groups the performance of the grid decreases significantly. The reason for that is that__getDistributedWidthruns__getIntrinsicWidthseveral times for nested columns when measuring a group:web-components/packages/grid/src/vaadin-grid.js
Lines 627 to 629 in 542c8e1
web-components/packages/grid/src/vaadin-grid.js
Lines 638 to 641 in 542c8e1
This change adds a cache that gets populated with the intrinsic width of columns after they have been measured, so that they don't need to be measured again. The cache is reset when
recalculateColumnWidthsis called again.Testing this with the grid benchmark tests in
flow-components, using 50 columns, 10 groups, results in the following rendering times (avg of 20 measurements):The logic could probably also be rewritten to do measurement in multiple phases, however this solution seems like a reasonable alternative in the meanwhile.
Type of change