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

Sync small-sized information across all projects in one batch call. #72975

Merged
merged 14 commits into from
Apr 12, 2024

Conversation

CyrusNajmabadi
Copy link
Member

in a solution like roslyn, we end up having 900 "projects" (where you get multiple roslyn-projects corresponding to each flavor a normal vs project). Querying for data for these individually adds up. Now, we can do things like ask for the attributes of all those projects in a single batch call.

What we still do at a per-project level is query it for its documents.

Note: there will be a followup to this PR that takes all these calls and allows them to run in parallel (dropping sync time in about 1/3rd).

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 10, 2024
}

await SynchronizeProjectAssetsAsync(allProjectStateChecksums, cancellationToken).ConfigureAwait(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass in all projects of interest here so we can sync individual bits of data for all of them at once.

AddAll(checksums, projectChecksums.Documents.Checksums);
AddAll(checksums, projectChecksums.AdditionalDocuments.Checksums);
AddAll(checksums, projectChecksums.AnalyzerConfigDocuments.Checksums);
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a lot of duplication that happens in the new code. the followup moves those into helpers that dedupe the pattern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the followup also makes us do this work in parallel

@@ -264,16 +264,25 @@ static SourceGeneratorExecutionVersionMap FilterToProjectCone(SourceGeneratorExe
}

using var _2 = ArrayBuilder<ProjectInfo>.GetInstance(out var projectInfos);
using var _3 = ArrayBuilder<ProjectStateChecksums>.GetInstance(out var projectStateChecksumsToAdd);

// added project
foreach (var (projectId, newProjectChecksums) in newProjectIdToStateChecksums)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two loops now. the first to collect the projects to bulk sync. the second create the projectinfos with the newly sync'ed data to update the solution

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review April 10, 2024 22:42
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 10, 2024 22:42
@CyrusNajmabadi
Copy link
Member Author

@ToddGrun this is ready for review.

@CyrusNajmabadi CyrusNajmabadi merged commit 170a0d3 into dotnet:main Apr 12, 2024
27 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 12, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the syncStripes branch April 13, 2024 02:55
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski For review when you get back.

@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants