-
-
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
[List] Rendering performance issue #3289
Comments
Yeap, I can confirm this. The |
Thanks for the link. I'll try to see why it is so slow. |
@cgestes It's not just the initial render that's slow. Consecutive renders will also be slow since we don't implement |
@oliviertassinari @cgestes @alitaheri Any news on this. I have a list with 300 MenuItems and it is impossible to use this right now. Any workarounds? |
Then you know what to do! 😄 |
After reading through issues such as this I am wondering if we should try to add some performance checks to the test suite. Not 100% sure right this second how it would be implemented. Just food for thought. (Actual performance benchmarks -- not just checking for rerenders under conditions we expect to prevent it in |
Yeah, I think it's a great idea. Let me know if you develop any thoughts on how we can best prepare for implementing that. |
@newoga My initial thought is setting up a test bed component to help identify areas we need either pure components or classes implementing
We can't depend on the CI server always spitting back the same results, so we need some sort of a control to run on every test as a baseline for the system that the benchmarks are currently running on. We can then use that control to assess the benchmark output. |
@newoga Just to add to my last reply -- I think this is something that we can work into the browser test suite. |
@nathanmarks These are good ideas.
That's a good point. I suppose one option is to set up a basic dummy component that implements Lots to think about but I think getting this component setup is a good start. Even if we can run it on CI yet, it'd be helpful to run on our development machines since the results should be consistent there. |
@newoga The wasted time is good to check for to prevent PRs introducing performance regressions. (and also helps highlight a number of existing performance issues) |
Obviously we will want to test the performance impact outside of wasted time too. But wasted time is the first thing to go on the chopping block ;). It's one of the biggest issues I found in my own testing. |
@nathanmarks Definitely, I agree! I think starting with the test component to assist with identifying wasted time across the codebase is a great start. |
@newoga Check this PoC out: Text field spec to reproduce the underline and label wasting time: Snags on the first assertion, so spits this out:
There are 100 loops by default, so the 99 instances represents the wasted # of renders in this case. I set this up to help address #2860 |
@nathanmarks Awesome, that was quick! I haven't tried it yet but I look at the PoC on Github and it looks like it makes sense. That's a really cool test. I could see this eventually becoming a |
@nathanmarks I'm possibly seeing opportunities to expand on this but maybe we should just leave this as is and start improving performance where we can. For example, you could probably create a PR with these fixtures and test and wrap the internal TextField components with recompose's pure HOC and see if it passes. |
@newoga Yup, great idea! I had a similar thought but didn't want over-abstract until we understood more of the performance test use cases better. One thing that makes the helper tricker is keeping the config for it concise but allowing it to performance test components with various types of prop types and combinations. The boilerplate-ish code in the The Later today/tonight I'll do up a PR to fix the textfield issues presented by this example, they're annoying me :) |
I'm with you 💯 percent. Sounds like a plan! |
I'am delected to read about adding performance tests :) And eventually fixing them. As you pointed the initial render time is quite important. I wonder if using CSS like hover instead of js state change would help also. (no rerender) I dont have a lot of time to work on the subject and wait for memoization to come in, but I definitively plan to work on the perf of multi items components. |
@cgestes When I take a look at this issue I'll add in some things to help measure initial rendering time -- the issue I chose for the initial example was regarding performance with re-renders. I'll take a look at this after I get the chance to wrap that one up. |
This should not be merged until mui/material-ui#3289 is fixed. Opening the dropdown causes about 4000ms under a desktop, using Chrome. This provides a awful UX to users because of the lag issue.
Got it, thank you! |
Hey, just wondering if anyone is looking in to this or if some help is needed? I make heavy use of tables in my project and i would love to continue using material-ui to render them but this performance thing is a problem so i would love to help if anyone's got some info on whats going on. |
@linde12 As we have identified two major inefficient patterns:
|
For anyone interested here's a reskin of react-select I did as a stop gap to replace SelectField until its performance issues are sorted: http://codepen.io/gerbal/pen/dXaJyK |
As previously mentioned, inline styles degrade performance. 😞 Moving away from inline styles would be a wise long-term choice to keep material-ui snappy. Sluggish UI components aren't all that usable. The good news is I've used a good portion of the material-ui components and this is the first time I observed a substantial performance issue. However, you likely wouldn't be able to move away from inline styles without introducing breaking changes. For example, consumers of the project may have to augment their existing build setups (e.g., adding |
Just noticed this issue today. I have a List with nested ListItems that render tables. Sooooo slow. Glad to see you're on top of it 👍 |
@dcworldwide In the meantime, you could try using https://github.com/bvaughn/react-virtualized to render a very large amount of |
@oliviertassinari do you have an example of using react-virtualized with material-ui table or list? I'm having trouble seeing how the integration happens. |
@noahdesu Actually, I'm wondering if it's even possible with the |
setting
p.s. works for me on json with 1K+ nested items |
@neil-rubens except when you want the user to see all his options, have some scroll bar there :) |
What's the status on this issue, what would be the best way for me to contribute? |
@yunderboy I have migrated a part of my app using the I'm wondering about the first example benchmark. It's not creating
That's pretty much the win I have measured. That's a first approximation of what we are going to get with the CSS-in-JS approach of the |
I know this is an ongoing discussion and some attempts have been made to alleviate the performance issues (e.g., shouldComponentUpdate). I have improved performance using Chrome on my Macbook, but in testing via Browserstack on IE11 and Edge, the Checkbox component I'm using in my material-virtualized table is basically unusable. It's taking several seconds to check/uncheck which obviously is untenable. We are currently using material-ui 0.16.4. Has the most recent version (0.16.7) made any improvements to the performance of material-ui Checkboxes? |
@KarenKelly818, |
Yes, the performance of the |
I need to Perform UI Automation testing on my MUI Table but when I run my testing it Perform Automation on all tags when it comes to MUI table's Tr(table row) it does not perform any Automation. I am using XPath for this. |
@nscozzaro Move your list item contents out of the loop you create them in to a small dedicated component, use |
@dantman I tried the way you suggested but it is taking time to load if we have more then 200 records in list. |
I've been successful with using a timeout hook, so the initial render isn't bad. This combined with
|
I ran the following tests in chrome:
Standard MUI:
Same as MUI but with inline style:
Same as MUI but with CSS:
Results:
MUI: 19sec
Inline: 4sec
CSS: 3sec
The text was updated successfully, but these errors were encountered: