Skip to content
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

[charts] Filter item outside the drawing area for perf #14281

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Aug 21, 2024

I noticed that zooming on 5% of the data takes as much time to render than a full zoom out. The more we zoom the faster it should render since less elements are to plot

For Bar charts, zoning on 5% of a 1,000 bars (only shows 50 bars out of the 1,000) makes the rendering time move from 100ms to 28ms

@alexfauquette alexfauquette added performance component: charts This is the name of the generic UI component, not the React module! labels Aug 21, 2024
@mui-bot
Copy link

mui-bot commented Aug 21, 2024

Deploy preview: https://deploy-preview-14281--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against be25a37

Copy link

codspeed-hq bot commented Aug 21, 2024

CodSpeed Performance Report

Merging #14281 will improve performances by 70.56%

Comparing alexfauquette:filter-with-zoom (7f8dbdc) with master (7120da2)

Summary

⚡ 2 improvements
✅ 1 untouched benchmarks

🆕 3 new benchmarks

Benchmarks breakdown

Benchmark master alexfauquette:filter-with-zoom Change
BarChart with big data amount 1,213.9 ms 711.7 ms +70.56%
🆕 BarChartPro with big data amount N/A 308.8 ms N/A
🆕 LineChartPro with big data amount N/A 484.4 ms N/A
ScatterChart with big data amount 575.4 ms 518 ms +11.07%
🆕 ScatterChartPro with big data amount N/A 1.9 s N/A

@@ -1,5 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';

import type {} from '../typeOverloads';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise TS was not understading that pro component have zoom options

Comment on lines +168 to +175
if (
result.x > xMax ||
result.x + result.width < xMin ||
result.y > yMax ||
result.y + result.height < yMin
) {
return null;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That, plus the line .filter((rectangle) => rectangle !== null); ar the only modification. in this function. The rest is an indentation diff leading to some prettier modification

@alexfauquette alexfauquette marked this pull request as ready for review September 12, 2024 08:49
@@ -24,7 +24,7 @@ describe('ScatterChart', () => {
async () => {
const { findByText } = render(
<ScatterChart
xAxis={[{ data: xData }]}
xAxis={[{ data: xData, valueFormatter: (v) => v.toLocaleString('en-US') }]}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why but I had an issue on my computer. The default locale of .toLocaleString was not the same in the test and in the render (1 000 vs 1,000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants