Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid extra JTF collection/factory #9623

Merged

Conversation

drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Dec 16, 2024

LanguageServiceHost uses its own JTF collection and factory to track its work.

This class derives from OnceInitializedOnceDisposedAsync, which also has its own collection and factory.

@lifengl recently noticed this while investigating a hang and suggested that we reuse the base class's objects to reduce allocations and potentially even help avoid deadlocks.

Microsoft Reviewers: Open in CodeFlow

`LanguageServiceHost` uses its own JTF collection and factory to track its work.

This class derives from `OnceInitializedOnceDisposedAsync`, which also has its own collection and factory.

@lifengl recently noticed this while investigating a hang and suggested that we reuse the base class's objects to reduce allocations and potentially even help avoid deadlocks.
@drewnoakes drewnoakes added Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Tenet-Performance This issue affects the "Performance" tenet. labels Dec 16, 2024
@drewnoakes drewnoakes requested a review from a team as a code owner December 16, 2024 00:23
This value can be shared across all projects throughout the lifetime of VS. Making it static reduces allocations and causes the factory logic to run once, rather than per-project.
This avoids the overhead associated with the instance's re-entrancy prevention.
@drewnoakes drewnoakes merged commit a17bdcd into dotnet:main Dec 18, 2024
5 checks passed
@drewnoakes drewnoakes deleted the avoid-extra-jtf-collection-and-factory branch December 18, 2024 23:09
@dotnet-policy-service dotnet-policy-service bot added this to the 17.12 milestone Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Tenet-Performance This issue affects the "Performance" tenet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants