Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-341

Improve Performance of S1144 "UnusedPrivateMethodCheck"

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: None
    • Labels:
      None

      Description

      Activating rule S1144 UnusedPrivateMethodCheck creates a huge performance drop in ruling QA.
      Fix implementation so that its impact is not so severe.

      Previous implementation was doing a bottom-up search: registering on all ClassDeclarationTree we would look for all identifiers being a descendant (used) of the outermost class, and looking which method of current class was not used.
      By doing so, each inner class would recompute all descendants identifiers used inside the outermost class. In cases of huge files having many inner classes, this caused performance issues.

      Rule was rewritten so that we skip inner classes checks, and we do all the checks directly from the outermost class by looking at all its descendants FunctionDeclarationTree and IdentifierTree in a single pass. This avoids recomputing the sets of identifier and methods for each inner class

        Attachments

          Activity

            People

            • Assignee:
              christophe.zurn Christophe Zurn
              Reporter:
              christophe.zurn Christophe Zurn
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: