sonar-dotnet icon indicating copy to clipboard operation
sonar-dotnet copied to clipboard

Add caching for symbols retrieved by TokenTypeAnalyzer and SymbolReferenceAnalyzer

Open costin-zaharia-sonarsource opened this issue 3 years ago • 0 comments

Both TokenTypeAnalyzer and SymbolReferenceAnalyzer retrieve the same symbols and by caching them we will reduce the processor time used by these 2 rules in half. I did a POC and for the repro I've added I have the following results:

from:

    31.131   28      SonarAnalyzer.Rules.CSharp.TokenTypeAnalyzer
    31.065   28      SonarAnalyzer.Rules.CSharp.SymbolReferenceAnalyzer

to:

    29.596   41      SonarAnalyzer.Rules.CSharp.TokenTypeAnalyzer
     0.019   <1      SonarAnalyzer.Rules.CSharp.SymbolReferenceAnalyzer