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

[Performance] Improve UseValidPlatformString (CA1418) performance #6867

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

Youssef1313
Copy link
Member

No description provided.

@Youssef1313 Youssef1313 requested a review from a team as a code owner August 19, 2023 19:31
}
}

public static IEnumerable<AttributeData> GetAttributes(this ISymbol symbol, INamedTypeSymbol? attributeTypeToMatch1, INamedTypeSymbol? attributeTypeToMatch2)
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: This is called for every named type, method, property, field, and event in the compilation. So using the params overload was likely inefficient.

An alternative is that the analyzer would pre-allocate a single array at compilation start, but I went with these overloads so that other analyzers could benefit as well.

@codecov
Copy link

codecov bot commented Aug 19, 2023

Codecov Report

Merging #6867 (7e193b4) into main (3587540) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6867      +/-   ##
==========================================
- Coverage   96.39%   96.39%   -0.01%     
==========================================
  Files        1403     1403              
  Lines      330977   330996      +19     
  Branches    10890    10894       +4     
==========================================
+ Hits       319055   319072      +17     
- Misses       9188     9191       +3     
+ Partials     2734     2733       -1     

Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@buyaa-n buyaa-n merged commit 837c22a into dotnet:main Sep 12, 2023
14 checks passed
@Youssef1313 Youssef1313 deleted the valid-platform-perf branch September 13, 2023 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants