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

[docs-infra] Fix light/dark mode & RTL change speed regression #44534

Open
oliviertassinari opened this issue Nov 24, 2024 · 4 comments
Open
Labels
bug 🐛 Something doesn't work performance priority: important This change can make a difference regression A bug, but worse scope: docs-infra Specific to the docs-infra product

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 24, 2024

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

v4 dark

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
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

cc @romgrk as related to performance on styled engine.

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work performance priority: important This change can make a difference status: waiting for maintainer These issues haven't been looked at yet by a maintainer regression A bug, but worse scope: docs-infra Specific to the docs-infra product labels Nov 24, 2024
@romgrk
Copy link
Contributor

romgrk commented Nov 25, 2024

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?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Nov 25, 2024

I guess this comes from every style being recomputed, even with a super fast styling engine this would be a noticeable delay

@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.
I suspect that the root cause is that we miss performance regression tests in each PR. If we had, I imagine that the PRs that led to this outcome wouldn't have been merged.

@DiegoAndai DiegoAndai removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 29, 2024
@DiegoAndai
Copy link
Member

DiegoAndai commented Nov 29, 2024

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?

@DiegoAndai DiegoAndai moved this to Selected in Material UI Nov 29, 2024
@DiegoAndai DiegoAndai removed this from Material UI Nov 29, 2024
@romgrk
Copy link
Contributor

romgrk commented Nov 30, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work performance priority: important This change can make a difference regression A bug, but worse scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

No branches or pull requests

4 participants