Don't load parts early from MEF that aren't needed#62090
Merged
jasonmalinowski merged 4 commits intodotnet:mainfrom Jun 27, 2022
Merged
Conversation
When our package loads, we register our library objects which is what drives class view and object browser. The constructor for this proactively loads a few services which are then only used if you invoked go to definition or find references through the object browser. It's a tiny cost (25ms) in one trace but each little bit counts when trying to make load times better.
JoeRobich
approved these changes
Jun 22, 2022
sharwell
suggested changes
Jun 23, 2022
src/VisualStudio/Core/Def/Library/ObjectBrowser/AbstractObjectBrowserLibraryManager.cs
Outdated
Show resolved
Hide resolved
sharwell
reviewed
Jun 23, 2022
sharwell
reviewed
Jun 23, 2022
The base type had a property also holding this, and oddly we used it in the derived type too.
Member
Author
|
@sharwell: updated some of the places to avoid the fire-and-forgets that this PR was touching. I wouldn't be surprised if there's plenty more badness in this area of the codebase, but I don't want to hold up the original intent of this PR trying to fix unrelated things. |
sharwell
reviewed
Jun 27, 2022
|
|
||
| // Fire and forget | ||
| _ = GoToSourceAsync(index, srcType); | ||
| var asynchronousOperationListener = LibraryManager.ComponentModel.GetService<IAsynchronousOperationListenerProvider>().GetListener(FeatureAttribute.LibraryManager); |
Contributor
There was a problem hiding this comment.
💡 Can we make this a property of LibraryManager?
sharwell
approved these changes
Jun 27, 2022
Contributor
sharwell
left a comment
There was a problem hiding this comment.
Would like to see the listener refactored for easy re-use in the component, but now looks good.
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.
When our package loads, we register our library objects which is what drives class view and object browser. The constructor for this proactively loads a few services which are then only used if you invoked go to definition or find references through the object browser. It's a tiny cost (25ms) in one trace but each little bit counts when trying to make load times better.