fix: optimization render task performance #348
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.
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