-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Problem:** <img width="1402" alt="image" src="https://github.com/user-attachments/assets/b83471ac-1eee-4e11-be7f-584c3a441e84"> There's a `shouldUpdate` function in ComponentRendererComponent which is not cheap, and it is memoized, and it's called 8 times for each canvas update, even for components where shouldUpdate will eventually be false. **Fix:** Turning shouldUpdate into a memoized function, only recalculating the value when any of its inputs change: <img width="1044" alt="image" src="https://github.com/user-attachments/assets/df866148-825f-4ac0-9230-78daa698f7c0"> The time spent goes from ~1.5ms to sub 0.2ms. This is doubly relevant because I have a follow-up PR which introduces shouldUpdate-style callbacks to even more places.
- Loading branch information
1 parent
95d88b8
commit b45b071
Showing
5 changed files
with
83 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters