optim(watch): don't reset DocumentRegistry b/t watch cycles#388
Merged
ezolenko merged 1 commit intoezolenko:masterfrom Aug 8, 2022
Merged
optim(watch): don't reset DocumentRegistry b/t watch cycles#388ezolenko merged 1 commit intoezolenko:masterfrom
DocumentRegistry b/t watch cycles#388ezolenko merged 1 commit intoezolenko:masterfrom
Conversation
- we can re-use the same one during watch instead of resetting it in the `options` hook - should make the LS a bit faster / more efficient in watch mode as most source files are shared between watch cycles
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.
Summary
Keep the
DocumentRegistryb/t watch cycles instead of resetting it3.specificallyDetails
optionshookPotential Further Optimizations
DocumentRegistrycan actually be shared between multiple LSes for Recommendation for multi-module setup? Memory leak with 18+ Rollup watchers #177. Per the TS LS Wiki, sharingDocumentRegistryis actually recommended, as, minimally,lib.d.tscould be shared between projects.DocumentRegistryas a top-level var, before the plugin is instantiated... that would makeDocumentRegistryshared between all imports of rpt2... but it would still be limited to only the same Node process... so guess that's probably not useful either in this case 😕tsModuleisn't set till plugin instantiation (as visible in this PR, where theDocumentRegistryis only instantiated aftertsModuleis set)...parsedConfighasn't changed between watch cycles, which is probably the most common usage of watch anyway, i.e. changing source files and not config