-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Tooltip] Performance issue when lots of tooltips are used in a table #27057
Comments
I also noticed that the blocking time is reduced if I use a simple
instead of an Icon:
I'm guessing a more complex child causes the rendering time to increase? The blocking time goes from |
Performance is similar in V5: https://codesandbox.io/s/material-demo-forked-etgwf?file=/demo.tsx |
Replacing |
@cmacdonnacha Do you benchmark in development or production? I would suspect the difference of performance between md-tooltip and react-tooltip to come from emotion. If this is confirmed, then it could be relevant for dev that extreme performance to use the unstyled version of the tooltip: mui/base-ui#10 + plain CSS. |
Hey @oliviertassinari I benchmark in dev while debugging but also tried production. In dev the blocking time was 1557ms and in production it was 472ms which is much better but there's still a noticeable lag to the human eye when filtering a table with 50 rows and 9 columns (450 tooltips). The unstyled version sounds good, is this something that I can try out or is it in progress? |
For unstyled, @michaldudak is leading the effort in mui/base-ui#10, we accept contributions from the community. Now, the demo renders 1,600 tooltips. We have never designed the component for this amount of instances, and I don't think that we should start either now. 500 is about the limit we consider valid. You can check our data grid component that implements virtualization and memorization to make this use case fast. I'm actually surprised that you didn't face an issue with the table component too. I have also opened #27290 as from what I can benchmark, we also spend time on the |
No problem thanks, switching to |
The problem is that tooltip should be rendered only on mouse over/enter I wrote for myself a wrapper component
|
I used controlled tooltip to solve this issue. |
It seems like adding the
<Tooltip>
component in my table cells is causing some performance issues. I've used React Profiler to debug this and it's pointing toPopper
as taking up the most rendering time which I believe is what MUI uses for tooltips. Also, when I used the Chrome performance debugging tool I can see the blocking time is 3 times bigger when using Tooltips.Current Behavior 😯
Table becomes laggy when tooltips are used.
Expected Behavior 🤔
Table remains performant when tooltips are used.
Steps to Reproduce 🕹
This isn't an exact demo of my own use case, I just forked one of the demos, but it shows how the Tooltips slow things down when clicking on "Select all" checkbox. In my own use case the performance hit is a bit more severe as I'm filtering the table at the same time.
With tooltips: https://codesandbox.io/s/material-demo-forked-fs4zu?file=/demo.tsx:10280-10308
Without tooltips: https://codesandbox.io/s/material-demo-forked-wkdkk?file=/demo.tsx:11145-11234
Steps:
Context 🔦
I have a table with 50 rows and 9 columns, each cell has an icon and tooltip. When I filter the table it's very laggy but once I remove the tooltips it's perfectly fine.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: