Sync project level info in parallel.#72976
Conversation
|
|
||
| if (searchingChecksumsLeft.Remove(projectStateChecksums.CompilationOptions)) | ||
| result[projectStateChecksums.CompilationOptions] = projectState.CompilationOptions!; | ||
| await projectStateChecksums.FindAsync( |
There was a problem hiding this comment.
this code was duplicating exactly what projectStateChecksums.FindAsync already does. We just want to be able to search projects, just without a particular project-id provided. so this now defers to that helper to do that. thanks the enum values this is easy.
| : AbstractAssetProvider | ||
| { | ||
| private const int PooledChecksumArraySize = 256; | ||
| private const int PooledChecksumArraySize = 1024; |
There was a problem hiding this comment.
i upped this as i was gonig over 256 a fair bit (easy when we have 900 projects in roslyn alone).
| } | ||
|
|
||
| checksums.Clear(); | ||
| async Task SynchronizeProjectAssetCollectionAsync<TAsset>(Func<ProjectStateChecksums, ChecksumCollection> getChecksums, CancellationToken cancellationToken) |
There was a problem hiding this comment.
this is almost the same as the prior method. just the primary method says "we have one checksum of a particular type per project" whereas thsi method says "we have many checksums of a particular type per project".
Note; lots of checksums will be duplicated across projects (like metadata and analyzer references) so thsi hashset dedupes a lot most of the time.
|
|
||
| // Then sync each project's documents in parallel with each other. | ||
| foreach (var projectChecksums in allProjectChecksums) | ||
| tasks.Add(SynchronizeProjectDocumentsAsync(projectChecksums, cancellationToken)); |
There was a problem hiding this comment.
Can cross that bridge if it happens :-)
| // looked at. | ||
| await this.SynchronizeAssetsAsync<object, Dictionary<Checksum, object>>( | ||
| assetPath: AssetPath.SolutionAndTopLevelProjectsOnly, | ||
| assetPath: new(AssetPathKind.Solution | AssetPathKind.ProjectStateChecksums), |
| /// <summary> | ||
| /// Instance that will only look up solution-level data when searching for checksums. | ||
| /// </summary> | ||
| public static readonly AssetPath SolutionOnly = AssetPathKind.Solution; |
|
|
||
| ChecksumCollection? frozenSourceGeneratedDocumentIdentities = null; | ||
| ChecksumsAndIds<DocumentId>? frozenSourceGeneratedDocuments = null; | ||
| ChecksumsAndIds<DocumentId>? frozenSourceGeneratedDocumentTexts = null; |
There was a problem hiding this comment.
this got simplified to avoid an extra indirection and roundtrip. previously we would store the DocumentStateCheckums for the frozen SG docs. Then, OOP would ask for these, just to get the text checksum, just to call back into the host to get this. This changes to now just store the text checksums only.
|
@jasonmalinowski For review when you get back. |
Followup to #72975
Shaves off 5 seconds locally when syncing (from 15s to 10s).