-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[docs-infra] Fix light/dark mode & RTL change speed regression #44534
Comments
I guess this comes from every style being recomputed, even with a super fast styling engine this would be a noticeable delay. Imo the real solution to this problem would be CSS variables based theming, which I think aligns with the styling engine direction. @siriwatknp Wdyt? |
@romgrk I agree, if we look at the v4 performance level, it's not excellent. The alternative UI libraries in the space are faster now. So we should aim to be faster than v4. Now, here when I see v6 vs. v5 vs. v4. I can't help myself thinking: something is broken. What happened? We should be able to revert the changes that led to this outcome. |
Do we know the root cause for the change? Between Material UI v5 and v6, if emotion is used, not much changed. Or is this mainly a docs-infra issue? |
No idea about the cause. The docs pages are different though, so the system styling code isn't the only variable, we should test with a consistent test case. I'd love to look into it but I'm busy with the design-agnostic datagrid refactor, I could come back to this next month. |
I am starting to look into this. On dev mode, on the first Right to left switch it takes very long (I am testing on the current master - v7), I even got a page not responsive on one try. Consecutive switching are faster, but still slow. I will create an isolated example to see if the issue is the docs or the styled engine. |
The |
For mode improvement, there are 2 PRs:
After tested with the above PRs, it's 2x faster on my dev server: Before: 309-360ms ![]() After: 158-169ms ![]() |
I don't think RTL can be improved that much. |
I tried to test rtl isolated here: https://mui-rtl-v7.vercel.app/, it's start to get noticed after rendering 1000 card components. There may be ways to improve rtl too but it will require changes. Some conceptual ideas may include:
However, there may be slight improvements we can do on the docs in regards to this, there is a BIG difference between component pages vs other docs pages. |
Steps to reproduce
The light/dark mode and RTL toggle is today x4 slower? than what good enough is at in production, and the RTL/LTR toggle in dev mode is x5-50 slower than what good enough is at? It used to be ok-ish:
v4.12.4 - Dev: mode ~600ms, RTL: ~600ms, Prod: mode and RTL ~150ms
v5.0.6 - Dev: mode ~1,369ms, RTL, ~10,865ms, Prod: mode and RTL ~200ms
v6.1.8 - Dev: mode ~2,253ms, RTL ~ 59,761ms, Prod: mode and RTL ~800ms
Material UI doesn't feel like a credible option for developers with this performance.
Context
Same problem as #41117. Material UI is not usable like this, not truly. I mean, as a developer, this reinforces this story: I would only adopt Material UI for a new React project so that I can then contribute a fix to this. Otherwise, I wouldn't want to touch Material UI, there are better options out there nowadays, and it would only make sense to use the rich components of MUI anytime I can't find anything better.
Your environment
npx @mui/envinfo
cc @romgrk as related to performance on styled engine.
The text was updated successfully, but these errors were encountered: