-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use the project cone information in Scope.FindAssetsAsync (part 2) #72512
Conversation
This avoids full solution level searches in scenarios where a project cone is being searched. This was particularly bad when the AssetHint didn't indicate a project/document.
…nScope.FindAssetsAsync
@@ -14,6 +14,21 @@ | |||
|
|||
namespace Microsoft.CodeAnalysis; | |||
|
|||
internal readonly struct ProjectCone(ProjectId rootProjectId, IReadOnlySet<ProjectId> projectIds) : IEquatable<ProjectCone> |
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.
Core idea is that we have a strongly-typed view of the cone that we can capture in the scope object. That cone info can help reduce unnecessary work with syncing.
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_Checksum.cs
Outdated
Show resolved
Hide resolved
return AsyncLazy.Create(static (arg, c) => | ||
arg.self.ComputeChecksumsAsync(arg.projectConeId, c), | ||
arg: (self: this, projectConeId)); | ||
} |
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.
inlined this. no need for the local function since Todd moved this to static lambdas.
_lazyChecksums = AsyncLazy.Create(static (self, c) => | ||
self.ComputeChecksumsAsync(projectId: null, c), | ||
arg: this); | ||
_lazyChecksums = AsyncLazy.Create(static async (self, 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.
style preference. i like to use cancellationToken
for callbacks. that way if there is a cancellationToken in scope, it will hide it and we don't accidentally capture the wrong thing. less relevant for static lambdas. but i like to be consistent with that.
src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState_Checksum.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.
Azure Pipelines successfully started running 4 pipeline(s). |
@jasonmalinowski For review when you get back. |
Followup to #72509.
This avoids full solution level searches in scenarios where a project cone is being searched. This was particularly bad when the AssetHint didn't indicate a project/document.