-
Notifications
You must be signed in to change notification settings - Fork 172
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
Fix/memoized should update #6098
Merged
Merged
Conversation
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
#13436 Bundle Size — 62.63MiB (~+0.01%).
Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
|
Current #13436 |
Baseline #13428 |
|
---|---|---|
Initial JS | 45.7MiB (~+0.01% ) |
45.7MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 21.54% |
21.99% |
Chunks | 31 |
31 |
Assets | 34 |
34 |
Modules | 4374 |
4374 |
Duplicate Modules | 523 |
523 |
Duplicate Code | 31.69% |
31.69% |
Packages | 469 |
469 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #13436 |
Baseline #13428 |
|
---|---|---|
JS | 62.62MiB (~+0.01% ) |
62.62MiB |
HTML | 11.16KiB (-0.33% ) |
11.2KiB |
Bundle analysis report Branch fix/memoized-should-update Project dashboard
ruggi
approved these changes
Jul 18, 2024
bkrmendy
approved these changes
Jul 18, 2024
gbalint
approved these changes
Jul 18, 2024
liady
approved these changes
Jul 18, 2024
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
**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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem:
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:
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.