dotnet/roslyn
View on GitHubFavor `Kind` check over type checking when appropriate
Open
#69,048 opened on Jul 15, 2023
Area-CompilersArea-Performancehelp wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
Type checking here is 2.8% of CPU time. A good portion of it happens for symbols.
Would the following be more efficient?
if (symbol.Kind == SymbolKind.KindWeLookFor)
{
return Unsafe.As<SymbolTypeToCastTo>(symbol);
}