perf(hmr): keep track of already traversed modules when propagating update#12658
Merged
perf(hmr): keep track of already traversed modules when propagating update#12658
Conversation
|
|
Contributor
|
I tried this on my repo where I was having issues with thousands of HMR updates and it fixes the HMR performance for me. |
Member
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
bluwy
approved these changes
Apr 1, 2023
Member
bluwy
left a comment
There was a problem hiding this comment.
Forgot to loop back on this PR, but this looks like a nice and safe change. ecosystem-ci seems to be invalid for the failing ones.
patak-cat
reviewed
Apr 5, 2023
| importer, | ||
| traversedModules, | ||
| boundaries, | ||
| currentChain.concat(importer), |
Member
There was a problem hiding this comment.
Looks great! Let's merge so we can test it during the beta.
Later on, maybe it is worth exploring using a data structure for currentChain/propagateUpdate that doesn't require the creation of new arrays on every call.
patak-cat
approved these changes
Apr 5, 2023
7 tasks
9 tasks
This file contains hidden or 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
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.
Re: #12062
Not sure this is a complete fix, but probably helps.
This will mostly help people having tree structure like this:
Note: This is not an adviced pattern, and I highly recommend having direct imports from views to components inside the same project. This will always lead to faster HMR (not all views need to refresh on an non self accepting file that is currently re-exported by a barrel file)
I also changed the data structure of
boundariesto an array because a set is misleading