dotnet/roslyn

Favor `Kind` check over type checking when appropriate

Open

#69,048 opened on 2023年7月15日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-CompilersArea-Performancehelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

image

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);
}

コントリビューターガイド