-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Boost layout performance #2015
Boost layout performance #2015
Conversation
@@ -47,6 +48,7 @@ function Row<R, SR = unknown>({ | |||
onDragEnter={wrapEvent(handleDragEnter, onDragEnter)} | |||
onDragOver={wrapEvent(handleDragOver, onDragOver)} | |||
onDrop={wrapEvent(preventDefault, onDrop)} | |||
style={{ top }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 1 concern here. Let's say if the user has their own RowRenderer
and they forget to add this top
to their wrapper. The whole layout would be messed up, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. If you pass top
back to Row
, or to your wrapper, you'll be fine though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't know if this worth it given by 5ms to 3ms improvement. As it makes the RowRenderer
error prone. And I bet people will create issues for this case when they use CustomRowRenderer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't custom row renderers already error-prone?
@nstepien can you catchup? |
@amanmahajan7 Done. |
Since we know all the widths/heights/positions of rows/cells, we can absolutely position the rows, and replace two padding divs with very dynamic
height
s, with one div with a more staticheight
.This improves layout perf from ~5ms to ~3.1ms on my machine. Might also improve more than layout rendering, not sure.
Before:
After: