-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Description
Seeing significant performance degradation when using Box components to style list item when iterating over arrays
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
When rendering components that use a lot of Box components, I see a visible slowdown in the UI and stops interaction across other elements in the application, which doesn't happen with native components.
Expected Behavior 🤔
I should not see that much of a performance degradation for using the Box component
Steps to Reproduce 🕹
Here is a codesandbox sample that shows the issue: https://codesandbox.io/s/hidden-smoke-hdhe6
Steps:
- Click 'Show Div List'
- Data will show without any delay
- Click 'clear'
- Click 'Show Box List'
- After a small delay the data shows
Looking at the performance tab on chrome, this is what I see:
Box List
Div List
To be honest I am not too familiar with the performance tab, so I am not sure if what I measured is relevant. But if I am looking at this correctly it seems to be more than 10x performance degradation.
Context 🔦
I have been having some performance issues in the project i've been working on, yesterday I tried to investigate why those issue where happening, and after digging a bit, it seems the reason why I am seeing bad performance across the application is because of our usage of the Box component
Given I didn't saw any warning in the docs I freely used the Box component across the application without expecting performance issues. A lot of styling in the application is done this way.
If this is something that can't be solved, and it's just the overhead that the Box component introduces, I think there should be a notice on the Box component component page so that people avoid this type of usage.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.8.3 |
React | v16.13.1 |