Cache the latest source file from document registery in script info so that we do not have to reparse orphan script info #24206
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.
Previously we kept around script infos that are not part of any project around till next file open request so that we can reuse them. But that just stored their text and not source file. Thus resulting in overhead of reparsing the source file when these orphan script infos are included in project. The parsing can run into multiple seconds (eg. 2.6+s for sass.async.js from require("sass.js") mentioned in #19458)
With this change we keep the source file and document registery key so that we can reuse or incrementally parse the source file for next project inclusion. This reduced the time spent in updateGraph from 3s to few ms
Note still completion isnt instant and thats because now the time is spent in diagnostics check for projectUpdatedInBackground. Will have a separate PR to address that.