refactor(@angular-devkit/schematics): improve performance of move()#12857
Merged
Conversation
c22386c to
ef22f5a
Compare
hansl
approved these changes
Nov 2, 2018
0ea3c44 to
aa7eb81
Compare
aa7eb81 to
4f6b98d
Compare
efafdb0 to
a85c6ee
Compare
a85c6ee to
9639c11
Compare
Contributor
|
@hansl - Please add merge target |
hansl
approved these changes
Nov 7, 2018
Contributor
|
🙌 |
Member
|
Just a comment that mutating within a visitor is probably not something that should be encouraged and probably should break. I know it is already there but walking the entire tree before actually visiting has performance implications in light of the ability to short circuit as well as logic issues depending on the mutation of the original tree. We should also consider deprecating |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
movegoes through every single file in the workspace which includesnode_moduleswhich could possible be nested via tools like Lerna. Also for very large workspaces the same issues exist for source code.Expected Behavior
Credits to @JamesHenry:
moveshould operate on just the sub tree so it will be fast even for huge workspaces.Notes
DirEntry.visitwas never ending if the visitor function renamed a file to a dir within itself (which the new implementation ofmovedoes), since it would mutate theDirEntrywith a new file which it would then visit… and cause a never ending loop..The old
movemitigated this by usingTree.visitwhich collects all the files within the rootDirEntryrecursively and then proceeding with the calling thevisitorfunction after all files were collected. I implemented a similar solution onHostDirEntry.visitandVirtualDirEntry.visitvia adding agetSubfilesRecursively()method which I keptprivatefor now so this could be released as a patch.cc @hansl @alexeagle