Skip to content

Avoid extra JTF collection/factory - #9623

Merged
drewnoakes merged 3 commits into
dotnet:mainfrom
drewnoakes:avoid-extra-jtf-collection-and-factory
Dec 18, 2024
Merged

drewnoakes merged 3 commits into
dotnet:mainfrom
drewnoakes:avoid-extra-jtf-collection-and-factory

Conversation

@drewnoakes

@drewnoakes drewnoakes commented Dec 16, 2024 •

Copy link
Copy Markdown
Member

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
@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