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

[Table] Avoid unnecessary re-rendering #13832

Merged
merged 4 commits into from
Dec 9, 2018
Merged

[Table] Avoid unnecessary re-rendering #13832

merged 4 commits into from
Dec 9, 2018

Conversation

petrjaros
Copy link
Contributor

Please consider this or similar change to improve performance of table re-rendering.
Before this change all table cells are going to re-render no matter the content of the cell changes or not. This improvement has big impact on frequently updating tables where only few cells changes.
See also: https://reactjs.org/docs/context.html#caveats

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example where it can be useful? Thank you!

@petrjaros
Copy link
Contributor Author

Here is a sample code without the proposed change: https://codesandbox.io/s/3x4ovmmk91
and with the proposed change: https://codesandbox.io/s/8rv4pnpkj

When I measure the performance in Chrome inspector I get much better performance with the second example:
https://3x4ovmmk91.codesandbox.io/ - ~80ms
https://8rv4pnpkj.codesandbox.io/ - ~20ms

@oliviertassinari oliviertassinari added performance component: table This is the name of the generic UI component, not the React module! labels Dec 8, 2018
@oliviertassinari oliviertassinari changed the title [table] Avoid unnecessary re-rendering of table cells [Table] Avoid unnecessary re-rendering of table cells Dec 8, 2018
@oliviertassinari oliviertassinari changed the title [Table] Avoid unnecessary re-rendering of table cells [Table] Avoid unnecessary re-rendering Dec 8, 2018
@oliviertassinari oliviertassinari merged commit 180d0f6 into mui:master Dec 9, 2018
@oliviertassinari
Copy link
Member

@petrjaros It's a great first pull request on Material-UI 👌🏻. Thank you for working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module! performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants