-
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
Search less files when searching in global suppressions. #57890
Conversation
@@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols | |||
internal sealed partial class SyntaxTreeIndex : IObjectWritable | |||
{ | |||
private const string PersistenceName = "<SyntaxTreeIndex>"; | |||
private static readonly Checksum SerializationFormatChecksum = Checksum.Create("25"); | |||
private static readonly Checksum SerializationFormatChecksum = Checksum.Create("26"); |
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.
our binary format is the same, but we cannot use any existing caches as the new and old data are not compatible with each other.
name = right; | ||
} | ||
|
||
if (!syntaxFacts.IsIdentifierName(name)) |
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.
is this even possible with GetNameOfAttribute
?
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.
yes. [A.B<int>()]
The current approach to finding FAR results in global suppressions is to make all documents with jsut a global attribute in it eligible for searching. This means any doc that has a
[assembly: ...]
attribute it in is searched (regardless of what attribute it actually is).This is doubly problematic as to search the doc we need the semantic-model for it, which requires getting the compilation for that project, which requires parsing all the files in the project. In a project like roslyn, we have enough of these attributes scattered everywhere to make it so that we effectively have to create most of the compilations for all our projects just to get no results.
This PR changes our logic to only search docs that actually have a global attribute whose name could match
SuppressMessageAttribute
. This means most projects have no hits and we produce no compilations.--
Note: this might mean we might something. For example, if the user has a global alias to SuppressMessageAttribute. But at that point, things are so esoteric i don't think we care at all, and the perf win here is substantive enough to warrant it. If we do want to support such a corner case in the future, we always could, by using a similar mechanism we have in other places where we keep track if alias names and check those. But for this the complexit is likely never going to be worth it given how this should not arise in practice.