Better reuse of package.json cache, module resolution cache, and package.json auto import filter#47388
Merged
andrewbranch merged 6 commits intomicrosoft:mainfrom Jan 18, 2022
Conversation
Member
|
Some very basic questions, since this isn't really my area:
|
Member
Author
|
Member
|
Yeah I don't think the cached json is going to be a problem before the code itself is a problem given normal ratios of the two. |
Member
|
Member
Author
|
(4) is because there’s simply no new information to write back to the cache. In order to have files available for auto-import in the first place, module resolution already had to find them and read their package.jsons. Theoretically we shouldn’t hit one we haven’t already seen. Updating a cache that belongs to module resolution outside of module resolution does feel sketchy, and I would probably avoid it. But in this case there’s nothing to update. |
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.
I made a test project that contained a lot of dependencies with export maps to ensure the new code paths were being hit. The slowdown from main to #47092 can largely be explained by the fact that we’re finding more things to auto-import, as the baseline case completely ignored those export maps. The cache reuse pays off in
collectAutoImports, where previously we had to read package.jsons that have already been read and cached. Note thatgetExportInfoMapandcollectAutoImportsare components ofcompletionInfo, which is the “bottom line” perf number for the server-side work of getting completions.