-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGridPremium] Improve aggregation performance for multiple columns #16097
Conversation
Deploy preview: https://deploy-preview-16097--material-ui-x.netlify.app/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change.
Unrelated optimization but we could speed this further by replacing the object params with regular params.
Thanks for the suggestion, I'll give it a try! |
Changing to regular parameters didn't bring significant improvements (547ms median compared to 548ms before the change). EDIT: it might have a bigger impact on memory footprint, but I didn't track it for this PR. |
Extracted from #9877
Why
Aggregation is one of the core features for pivoting. It often involves aggregating dozens of columns.
This PR improves aggregation calculation performance with row grouping and multiple aggregation rules.
How
I've changed the way we calculate aggregation value for each row group.
Before
getGroupAggregatedValue
). For each aggregation field:2. Get the child
rowIds
for the row group (getRowGroupChildren
). Requires traversing the group tree.3. Loop: Iterate over child
rowIds
and calculate the aggregated valueOptimizations:
1 x row_group
, as opposed to1 x row_group x aggregation_rule
.After
rowIds
for the row group (getRowGroupChildren
). Requires traversing the group tree.rowIds
. For each row:3. Loop: Iterate over aggregation rules and store row values.
Results
row grouping: by commodity
aggregation rules: 1
row grouping: none
aggregation rules: 1
row grouping: by commodity
aggregation rules: 6
row grouping: by commodity
aggregation rules: 10
row grouping: by commodity
aggregation rules: 17
row grouping: by price1M
aggregation rules: 50
Detailed results
Demos
Before: https://codesandbox.io/p/sandbox/wispy-leaf-r2kpzm
After: https://codesandbox.io/p/sandbox/wispy-architecture-8xpsg8