-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Compute classifications for FAR results in parallel. #73599
Conversation
@ToddGrun this is ready for review. |
@@ -201,7 +201,7 @@ async ValueTask IFindUsagesContext.OnDefinitionFoundAsync(DefinitionItem definit | |||
} | |||
} | |||
|
|||
ValueTask IFindUsagesContext.OnReferenceFoundAsync(SourceReferenceItem reference, CancellationToken cancellationToken) | |||
ValueTask IFindUsagesContext.OnReferencesFoundAsync(ImmutableArray<SourceReferenceItem> references, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one change is that we're updating one of the APIs here to be chunky instead of chatty.
@@ -107,20 +108,26 @@ public async ValueTask OnDefinitionFoundAsync(SymbolGroup group, CancellationTok | |||
} | |||
|
|||
public async ValueTask OnReferencesFoundAsync( | |||
ImmutableArray<(SymbolGroup group, ISymbol symbol, ReferenceLocation location)> references, CancellationToken cancellationToken) | |||
IAsyncEnumerable<(SymbolGroup group, ISymbol symbol, ReferenceLocation location)> references, CancellationToken cancellationToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another API is also moving to streaming, instead of chunking. Since it itself will have this ProducerCOnsumer.RunParallel in it. So it can just consume whatever is thrown at it, chunking it itself.
if (referenceItem != null) | ||
await context.OnReferenceFoundAsync(referenceItem, cancellationToken).ConfigureAwait(false); | ||
} | ||
await ProducerConsumer<SourceReferenceItem>.RunParallelAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is the major win. allowing us to be computing the info for hte fuond references in parallel, sending out chunks of them to the client as we can. while a chunk is in flight, we continually compute and buffer more. sending the next chunk once we can.
src/Features/Core/Portable/FindUsages/AbstractFindUsagesService.ProgressAdapter.cs
Show resolved
Hide resolved
src/Workspaces/Core/Portable/FindSymbols/IStreamingFindReferencesProgress.cs
Outdated
Show resolved
Hide resolved
{ | ||
foreach (var (_, definition, location) in references) | ||
lock (_gate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it takes it as much as before. just the loop is here, instead of receiving the individual messages and taking the lock. i'm ok with this as i haven't seen it show up. if it does show up, we can adjust.
.../Portable/FindSymbols/FindReferences/FindReferencesSearchEngine_FindReferencesInDocuments.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Remote/ServiceHub/Services/FindUsages/RemoteFindUsagesService.cs
Show resolved
Hide resolved
.../Portable/FindSymbols/FindReferences/FindReferencesSearchEngine_FindReferencesInDocuments.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a large savings that gets us down to around 3 seconds for a expensive FAR total in Roslyn.