Skip to content

Conversation

@Janlaywss
Copy link
Contributor

fix: optimization task render performance

When my table column component is a custom component, the scrollLeft property always takes a long time when I slide the table.

As shown below, when I use Chrome Devtools Performance to analyze the scrolling behavior, Activity -> Layout takes the first place. Through tracking, it is found that the scrollLeft property has been reassigned in the scrollTo function.

The browser will calculate the value of the attribute on the spot whether it is assigning or acquiring scrollLeft. Perhaps because the browser layout tree is top-down, calculating scrollLeft is always much slower than calculating scrollTop
image.png

image.png

Our customized table based on react-base-table has more than 10 columns. So calculating scrollLeft will be slower. On my customized table, scrollLeft can get about 12ms, which is enough to block one frame of rendering.​


My suggestion is to use the assignment of scrollLeft in the next requestAnimationFrame. This can avoid blocking the execution of the current requestAnimationFrame.

image.png

When I modify it in my own custom table, the fps has been improved by about 20%, and the human eye is visually smoother.

Because of the confidentiality involved, my own case cannot be made public. I'm really sorry

@Janlaywss
Copy link
Contributor Author

@nihgwu

@Janlaywss
Copy link
Contributor Author

@tonnyskk

@nihgwu
Copy link
Contributor

nihgwu commented Dec 24, 2021

@Janlaywss thank you for your contribution and detailed explanation, will have a look soon

@nihgwu nihgwu merged commit 38e8d12 into Autodesk:master Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants