-
Notifications
You must be signed in to change notification settings - Fork 226
perf: Avoid duplicate dirty parent elements to improve performance by 2% #1968
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
Conversation
|
|
/gemini review |
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.
Code Review
This pull request improves performance by avoiding redundant dirtying of parent elements. The change terminates the upward traversal in dirtyToRoot if a parent is already marked as dirty. A potential correctness issue was identified where the loop might terminate prematurely, leading to rendering artifacts. The suggested solution involves refining the loop condition to ensure all necessary dirty flags are set.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* fix: prevent NaN in transform calculations when scale is 0 (#1971) * fix: prevent NaN in transform calculations when scale is 0 - Add MIN_SCALE constant to avoid zero scaling - Update scale transform functions to enforce minimum scale value - Add test case for scale(0) transform - Add demo example with scale(0) transform * chore: add changeset * refactor: extract scale clamping logic into reusable function - Add clampScale helper function to avoid code duplication - Replace repeated Math.max(item, MIN_SCALE) calls with clampScale - Maintain same behavior while improving code maintainability * chore: add changeset * perf: use charWidthCache to improve performance by 1.5% (#1978) * perf: 避免重复dirty父级元素提升2%性能 * perf: accept gemini review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * refactor: 修复eslint * perf: use charWidthCache to improve performance by 1.5% * refactor: 修复评审意见 * refactor: 修复评审意见 * refactor: 使用LRU * refactor: 使用LRU * chore: add changeset --------- Co-authored-by: huiyu.zjt <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: wang1212 <[email protected]> * revert: fix element attribute update exception #1968 * chore(release): bump version (#1977) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: huiyu.zjt <[email protected]> Co-authored-by: huiyu.zjt <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
s2滚动场景下,有大量嵌套的节点会走到dirtyToRoot。排在前面的元素自下而上dirty后,排在后面的元素不需要再给父元素dirty了。
📝 Changelog
☑️ Self Check before Merge