-
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
Sync project level info in parallel. #72976
Merged
CyrusNajmabadi
merged 58 commits into
dotnet:main
from
CyrusNajmabadi:syncStripesParallel
Apr 12, 2024
Merged
Changes from 44 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
da8d7e0
Add perf logging
CyrusNajmabadi 9829da1
sync in strips
CyrusNajmabadi 3552d4b
in progress'
CyrusNajmabadi 6377536
fix
CyrusNajmabadi d150afd
downstream
CyrusNajmabadi a255fa8
Fetch attributes up front'
CyrusNajmabadi 6d82a4b
get info and text together
CyrusNajmabadi 87de924
Merge remote-tracking branch 'upstream/main' into syncStripes
CyrusNajmabadi 046d435
sync in parallel
CyrusNajmabadi c8b9a0f
fix
CyrusNajmabadi d140c85
delete
CyrusNajmabadi f82f5ad
Apply suggestions from code review
CyrusNajmabadi 58ae336
revert
CyrusNajmabadi ee6ce0a
Merge branch 'syncStripes' of https://github.com/CyrusNajmabadi/rosly…
CyrusNajmabadi 1033273
Merge branch 'syncStripes' into syncStripesParallel
CyrusNajmabadi c63c074
remove log helper
CyrusNajmabadi cdc412a
rename file
CyrusNajmabadi 2439f04
Search less
CyrusNajmabadi 939b9c4
rename
CyrusNajmabadi 357bfeb
rename file
CyrusNajmabadi c808509
Search less
CyrusNajmabadi 542020e
rename
CyrusNajmabadi 170a0d3
Merge branch 'syncStripes' into syncStripesParallel
CyrusNajmabadi 4c8be11
Merge remote-tracking branch 'upstream/main' into syncStripesParallel2
CyrusNajmabadi bd55071
Hybrid mode
CyrusNajmabadi bc626e2
Docs
CyrusNajmabadi 6cbd1b5
Share code
CyrusNajmabadi e15a73c
optimize
CyrusNajmabadi 69528e5
Add docs
CyrusNajmabadi 21ae618
Docs
CyrusNajmabadi 510331c
Share code
CyrusNajmabadi d8eb43a
Docs
CyrusNajmabadi 92654f4
Docs
CyrusNajmabadi afb12f6
fine grained kinds
CyrusNajmabadi d49c484
Simplify pattern
CyrusNajmabadi dc8ed7b
Only search solutions and project checksums
CyrusNajmabadi 5b3db93
Add asset hints
CyrusNajmabadi 8929756
REmove unused
CyrusNajmabadi 38902cf
Simplify more
CyrusNajmabadi 2a39c5c
Add implicit
CyrusNajmabadi 4304094
Use kinds uniformly
CyrusNajmabadi b4efb7f
Updates
CyrusNajmabadi e91b985
speeling
CyrusNajmabadi 6142d02
Simplify
CyrusNajmabadi 9cdb0bc
Do not capture
CyrusNajmabadi c9193fd
Finer grained kinds
CyrusNajmabadi 84e2b7a
Finer grained kinds
CyrusNajmabadi 633f604
in progress
CyrusNajmabadi b044039
in progress
CyrusNajmabadi 5569fb5
in progress
CyrusNajmabadi 2ff97df
in progress
CyrusNajmabadi 10f5b5e
in progress
CyrusNajmabadi 9c9f17b
Only doc text
CyrusNajmabadi 1229821
in progress
CyrusNajmabadi 06dd3e5
in progress
CyrusNajmabadi 4639794
Flesh out
CyrusNajmabadi b7638f6
tests
CyrusNajmabadi ec5ad04
docs
CyrusNajmabadi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 0 additions & 112 deletions
112
src/Workspaces/Core/Portable/Workspace/Solution/AssetHint.cs
This file was deleted.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
src/Workspaces/Core/Portable/Workspace/Solution/AssetPath.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.Serialization; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.Serialization; | ||
|
||
/// <summary> | ||
/// Required information passed with an asset synchronization request to tell the host where to scope the request to. In | ||
/// particular, this is often used to scope to a particular <see cref="Project"/> or <see cref="Document"/> to avoid | ||
/// having to search the entire solution. | ||
/// </summary> | ||
[DataContract] | ||
internal readonly struct AssetPath | ||
{ | ||
/// <summary> | ||
/// Instance that will only look up solution-level data when searching for checksums. | ||
/// </summary> | ||
public static readonly AssetPath SolutionOnly = AssetPathKind.Solution; | ||
|
||
/// <summary> | ||
/// Special instance, allowed only in tests/debug-asserts, that can do a full lookup across the entire checksum | ||
/// tree. Should not be used in normal release-mode product code. | ||
/// </summary> | ||
public static readonly AssetPath FullLookupForTesting = AssetPathKind.Solution | AssetPathKind.Projects | AssetPathKind.Documents; | ||
|
||
[DataMember(Order = 0)] | ||
private readonly AssetPathKind _kind; | ||
|
||
/// <summary> | ||
/// If not null, the search should only descend into the single project with this id. | ||
/// </summary> | ||
[DataMember(Order = 1)] | ||
public readonly ProjectId? ProjectId; | ||
|
||
/// <summary> | ||
/// If not null, the search should only descend into the single document with this id. | ||
/// </summary> | ||
[DataMember(Order = 2)] | ||
public readonly DocumentId? DocumentId; | ||
|
||
public AssetPath(AssetPathKind kind, ProjectId? projectId = null, DocumentId? documentId = null) | ||
{ | ||
_kind = kind; | ||
ProjectId = projectId; | ||
DocumentId = documentId; | ||
} | ||
|
||
public bool IncludeSolution => (_kind & AssetPathKind.Solution) != 0; | ||
public bool IncludeProjects => (_kind & AssetPathKind.Projects) != 0; | ||
public bool IncludeDocuments => (_kind & AssetPathKind.Documents) != 0; | ||
|
||
public bool IncludeProjectStateChecksums => (_kind & AssetPathKind.ProjectStateChecksums) != 0; | ||
public bool IncludeProjectAttributes => (_kind & AssetPathKind.ProjectAttributes) != 0; | ||
public bool IncludeProjectCompilationOptions => (_kind & AssetPathKind.ProjectCompilationOptions) != 0; | ||
public bool IncludeProjectParseOptions => (_kind & AssetPathKind.ProjectParseOptions) != 0; | ||
public bool IncludeProjectProjectReferences => (_kind & AssetPathKind.ProjectProjectReferences) != 0; | ||
public bool IncludeProjectMetadataReferences => (_kind & AssetPathKind.ProjectMetadataReferences) != 0; | ||
public bool IncludeProjectAnalyzerReferences => (_kind & AssetPathKind.ProjectAnalyzerReferences) != 0; | ||
|
||
public bool IncludeDocumentStateChecksums => (_kind & AssetPathKind.DocumentStateChecksums) != 0; | ||
public bool IncludeDocumentAttributes => (_kind & AssetPathKind.DocumentAttributes) != 0; | ||
public bool IncludeDocumentText => (_kind & AssetPathKind.DocumentText) != 0; | ||
|
||
public static implicit operator AssetPath(AssetPathKind kind) => new(kind); | ||
|
||
/// <summary> | ||
/// Searches only for information about this project. | ||
/// </summary> | ||
public static implicit operator AssetPath(ProjectId projectId) => new(AssetPathKind.Projects, projectId, documentId: null); | ||
|
||
/// <summary> | ||
/// Searches only for information about this document. | ||
/// </summary> | ||
public static implicit operator AssetPath(DocumentId documentId) => new(AssetPathKind.Documents, documentId.ProjectId, documentId); | ||
|
||
/// <summary> | ||
/// Searches the requested project, and all documents underneath it. Used only in tests. | ||
/// </summary> | ||
/// <param name="projectId"></param> | ||
/// <returns></returns> | ||
public static AssetPath SolutionAndProjectForTesting(ProjectId projectId) | ||
CyrusNajmabadi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
=> new(AssetPathKind.Solution | AssetPathKind.Projects, projectId); | ||
|
||
/// <summary> | ||
/// Searches all documents within the specified project. | ||
/// </summary> | ||
/// <param name="projectId"></param> | ||
/// <returns></returns> | ||
public static AssetPath DocumentsInProject(ProjectId projectId) | ||
=> new(AssetPathKind.Documents, projectId); | ||
} | ||
|
||
[Flags] | ||
internal enum AssetPathKind | ||
{ | ||
/// <summary> | ||
/// Search solution-level information. | ||
/// </summary> | ||
Solution = 1 << 0, | ||
|
||
ProjectStateChecksums = 1 << 1, | ||
ProjectAttributes = 1 << 2, | ||
ProjectCompilationOptions = 1 << 3, | ||
ProjectParseOptions = 1 << 4, | ||
ProjectProjectReferences = 1 << 5, | ||
ProjectMetadataReferences = 1 << 6, | ||
ProjectAnalyzerReferences = 1 << 7, | ||
|
||
/// <summary> | ||
/// Search projects for results. All project-level information will be searched. | ||
/// </summary> | ||
Projects = ProjectStateChecksums | ProjectAttributes | ProjectCompilationOptions | ProjectParseOptions | ProjectProjectReferences | ProjectMetadataReferences | ProjectAnalyzerReferences, | ||
|
||
DocumentStateChecksums = 1 << 8, | ||
DocumentAttributes = 1 << 9, | ||
DocumentText = 1 << 10, | ||
|
||
/// <summary> | ||
/// Search documents for results. | ||
/// </summary> | ||
Documents = DocumentStateChecksums | DocumentAttributes | DocumentText, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,9 +98,6 @@ public static Checksum ReadFrom(ObjectReader reader) | |
public static Func<IEnumerable<Checksum>, string> GetChecksumsLogInfo { get; } | ||
= checksums => string.Join("|", checksums.Select(c => c.ToString())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw, i hope we neve actually enable this one. it's insane. |
||
|
||
public static Func<ProjectStateChecksums, string> GetProjectChecksumsLogInfo { get; } | ||
= checksums => checksums.Checksum.ToString(); | ||
|
||
// Explicitly implement this method as default jit for records on netfx doesn't properly devirtualize the | ||
// standard calls to EqualityComparer<long>.Default.Equals | ||
public bool Equals(Checksum other) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: doesn't seem necessary. Almost all other callers just specify the AssetPathKind explicitly.