You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove ineffective per-syntax-node caches: ConcurrentDictionary<ParameterSyntax,…> / <MemberDeclarationSyntax,…> at ParameterName:83, ParameterOrdering:58, FileNameMustMatchType:52, OneTypePerDocument:60. A syntax node is visited exactly once per analyzer pass, so these never hit and only add dictionary overhead. (Keep the symbol-keyed caches — symbols recur, so those pay off.)
ParameterOrderingDiagnosticsAnalyzer.cs:80 — PreferredEndingOrdering.Reverse() re-materialized per parameter list; reverse once into a static field
ClassVisibilityDiagnosticsAnalyzer.cs:99 — [.. BaseClasses()] materializes a list per class node; enumerate lazily
Replace ForEach/FirstOrNull extension calls with plain foreach loops on hot paths (delegate + closure allocation per node)
Helpers/SupportedDiagnosisList.cs — single-rule overload uses ImmutableArray.Empty.Add; use a collection expression
Add compilation-start GetTypeByMetadataName bail-out gates to the analyzers that lack one and target types that may be absent from a compilation: ArgumentExceptionAnalysis, ClassAnalysis (BenchmarkDotNet), ClassVisibility (MockBase), DebuggerDisplayAnalysis, ForceMethodParametersInvocations, ParameterName/ParameterOrdering (ILogger), TestClass* trio (TestBase/xunit)
Helpers/TypeSymbolHelpers.cs:7 — ToFullyQualifiedName() allocates two strings per call (namespace ToDisplayString() + interpolation). After the Phase 2/3 sub-issues most hot callers should be gone; for the remainder, consider a SymbolEqualityComparer-keyed memo or eliminating the call sites entirely.
Verification: full test suite green, benchmarks show reduced allocations, no change in the set of diagnostics produced.
Part of #455.
ConcurrentDictionary<ParameterSyntax,…>/<MemberDeclarationSyntax,…>atParameterName:83,ParameterOrdering:58,FileNameMustMatchType:52,OneTypePerDocument:60. A syntax node is visited exactly once per analyzer pass, so these never hit and only add dictionary overhead. (Keep the symbol-keyed caches — symbols recur, so those pay off.)ParameterOrderingDiagnosticsAnalyzer.cs:80—PreferredEndingOrdering.Reverse()re-materialized per parameter list; reverse once into a static fieldClassVisibilityDiagnosticsAnalyzer.cs:99—[.. BaseClasses()]materializes a list per class node; enumerate lazilyForEach/FirstOrNullextension calls with plainforeachloops on hot paths (delegate + closure allocation per node)Helpers/SupportedDiagnosisList.cs— single-rule overload usesImmutableArray.Empty.Add; use a collection expressionGetTypeByMetadataNamebail-out gates to the analyzers that lack one and target types that may be absent from a compilation:ArgumentExceptionAnalysis,ClassAnalysis(BenchmarkDotNet),ClassVisibility(MockBase),DebuggerDisplayAnalysis,ForceMethodParametersInvocations,ParameterName/ParameterOrdering(ILogger),TestClass*trio (TestBase/xunit)Helpers/TypeSymbolHelpers.cs:7—ToFullyQualifiedName()allocates two strings per call (namespaceToDisplayString()+ interpolation). After the Phase 2/3 sub-issues most hot callers should be gone; for the remainder, consider aSymbolEqualityComparer-keyed memo or eliminating the call sites entirely.Verification: full test suite green, benchmarks show reduced allocations, no change in the set of diagnostics produced.