Repository navigation
Use a WeakMap instead of mutating objects in NMF - #7348
Merged
Merged
Conversation
Contributor
|
For maintainers only:
|
Contributor
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
sokra
requested changes
May 20, 2018
| this.context = context || ""; | ||
| this.parserCache = Object.create(null); | ||
| this.generatorCache = Object.create(null); | ||
| this.dependencyCache = new WeakMap(); |
Member
There was a problem hiding this comment.
Move this to module scope.
For each compilation pass, a new NormalModuleFactory is created.
Member
There was a problem hiding this comment.
Would it make more sense to pass as data options so the cache is shared across all compilations.
Member
There was a problem hiding this comment.
No. Module scope is fine. It's shared between all compilations.
ooflorent
force-pushed
the
refactor/nmf_cache
branch
from
May 22, 2018 17:06
ad7c7f9 to
8df9f5f
Compare
Contributor
|
@ooflorent Thanks for your update. I labeled the Pull Request so reviewers will review it again. @sokra Please review the new changes. |
sokra
approved these changes
May 22, 2018
Member
|
Thanks |
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.
NormalModuleFactorywas mutating dependency objects if theunsafeCacheoption was set. This PR uses aWeakMapto cache dependencies and avoid the mutation (and de-opt).What kind of change does this PR introduce?
refactoring
Did you add tests for your changes?
no
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
nothing