-
-
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
[DataGrid] Experiment without raf #507
Conversation
2ce1ac9
to
bb7696e
Compare
bb7696e
to
c1c7748
Compare
So? |
Don't forget to scroll while you run the fast streaming update story |
@dtassone No idea yet, I'm waiting for the deployment to test it in production mode. Is there a specific point to pay attention to? |
Just FYI I tried all that. But yeah let me know what you think |
Comparison cases:
Streaming:
I can't notice a difference. Do you? If I had to work on improving the performance of the grid, maybe I would start with this: If we apply this diff: diff --git a/packages/grid/_modules_/grid/GridComponent.tsx b/packages/grid/_modules_/grid/GridComponent.tsx
index f4c77126..a7a21487 100644
--- a/packages/grid/_modules_/grid/GridComponent.tsx
+++ b/packages/grid/_modules_/grid/GridComponent.tsx
@@ -92,6 +92,8 @@ export const GridComponent = React.forwardRef<HTMLDivElement, GridComponentProps
[gridState.options, gridState.containerSizes],
);
+ console.log('render')
+
return (
<AutoSizer onResize={onResize}>
{(size: any) => ( We see that the whole grid is rendered at each update (scroll or screaming push). Can we scale the performance of the grid by retaining this behavior? The more features we have, the more hooks function will be called at each render. I think that it could be interesting to benchmark the difference of performance when a scroll event or a streaming event re-render the least possible amount of hook/components, the Viewport only? |
There is already a logger.info at every render. Check the perf in develop... |
Yeah agree, we also need to consider this environment, as developers will experience it too. Could you confirm that the issue in development is that the scrolling events don't have enough priority over the update events (it freeze)? Or is there something else? |
Multiple things!
|
Fastest as the raf are well coordinated as they are shared in the whole component |
Do we have a benchmark to compare the two? I think that it should be paramount and come before any other type of discussion. Maybe we can invest time in it later on? @dtassone What do you think about the following to finish #506, I see two possible paths: a. useRafUpdate is a generic helper, it can't have a leaking side effect. We leave the logic untouched. It's used/can be used in different parts of the component. Instead, we add the RAF batching in the I think that a. is enough and simpler. Thoughts? |
Event handlers only as far as I know. Could you show me where you think requestAnimationFrame makes a difference? Renders should be pretty fast so I'm curious where you're hitting a bottleneck and why a custom scheduling implementation helps instead of the usual perf tricks. |
@eps1lon Oh nice! Yeah, I can confirm that in a codesandobx. |
Do you actually need to batch those though? I'd like to see a case where you hit a bottleneck without batching. Just because getting the scheduling right is incredibly hard (react is working on it for 2 years now) and will be obsolete once concurrent mode lands. |
@eps1lon Maybe we need, seeing React not batching imperative calls made me think that its could be required. One case we have used to stress test the data grid is streaming:
In the above, I can't observe any difference in production between the 3. Maybe we need a better test case. |
If state updates aren't batched then react has the opportunity (in the future) to schedule them accordingly. React not batching is not inherently a bad thing.
Development is slow and not an accurate representation of production performance. It is only really viable to be used with react's profiler. Could you explain how I can reproduce the bottleneck you observe in development i.e. what command to run, which page to visit, which interaction to trigger and when you observe the bottleneck. |
Opened to get the CI running