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

Box: Slow Performance #21797

Closed
cwagner22 opened this issue Jul 14, 2020 · 5 comments
Closed

Box: Slow Performance #21797

cwagner22 opened this issue Jul 14, 2020 · 5 comments
Labels
duplicate This issue or pull request already exists performance

Comments

@cwagner22
Copy link

cwagner22 commented Jul 14, 2020

I'm experiencing slow performance using Material UI's Box component. I have a collection of objects that I'm rendering (around 100) using multiple Box for each of them. However, it's slow and I've realized that the more I'm adding Boxes the worst it gets. Here is a codesandbox link to reproduce the issue.
With 200 items, just using Box takes around 1.8s to render.
And if using div instead of Box like here, it's instant.

Is there any way I can get increase the performance? I like the convenience of Box...

image

image

@cwagner22 cwagner22 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 14, 2020
@eps1lon
Copy link
Member

eps1lon commented Jul 14, 2020

I wouldn't recommend the Box without any props. It's for quick prototyping for design systems not a

replacement. See #21657 for more context.

@eps1lon eps1lon closed this as completed Jul 14, 2020
@eps1lon eps1lon added duplicate This issue or pull request already exists and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jul 14, 2020
@cwagner22
Copy link
Author

Well I’m using props which is why I would like to keep Box instead of div. This was just a quick example to demonstrate.

@mbret
Copy link

mbret commented Feb 11, 2021

We recently encoutered that issue too. We were using Box as a drop in replace for div. Seemed the right way based on the documentation and its a pretty convenient component for quick styling. App was weirdly slow but well we decided to check that later because of other priorities. Then we implemented the main list view. With just ~50 items it takes 1s to render, when having ~100 items, it takes 2s to render. This grows linearly with the number of items (until we reach our list recycle frame threshold). Since we are using recycled list, this is not a list problem and it worked perfectly during prototypes. This is also with PROD build. During development you can multiply the time to render by 3..

Point is that the app were completely unusable with barely nothing displayed on it. We then decided to replace every single Box with its div equivalent and the app is now blazing fast everywhere. The list renders instantly no matter the number of items.

At this point I am not sure why Box is slow like this but it looks like nobody should use it at all. I am a bit confused about the use case for it now.

@oliviertassinari
Copy link
Member

See #21657 (comment), the performance issue is largely solved in v5, at least it's x3-x5 faster now.

https://next--material-ui.netlify.app/branding/about/ is largely implemented with it, and it seems fast enough.

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 11, 2021

I'm locking as this issue is a duplicate of #21657

@mui mui locked as resolved and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists performance
Projects
None yet
Development

No branches or pull requests

4 participants