Skip to content

Invoke-PSScriptAnalyzer performance is very, very poor #197

Closed

Description

@KirkMunro

Even for modules that contain a small number of commands (44 for one of my modules), Invoke-PSScriptAnalyzer is way too slow. When I ran it recursively on that module folder, it took just under 2 minutes (1 minute, 53 seconds) to perform the analysis. That's just horrible. Imagine a module that has 100+ commands? Please consider how you might take advantage of multiple threads/processes/jobs, or reducing the amount of redundant AST work that is being performed across similar rules to improve performance.

I find myself wondering if rules could be designed to plug into a single AST walkthrough instead of having each rule do its own AST searching/processing. Perhaps the notion of rule sets should be considered in order to permit certain rules to plug into a speedier process tailored to a particular area/feature/subset of PowerShell that is being analyzed. Those are just a few ideas that came to mind when thinking about how to solve this problem, but I imaging a profiling tool would identify at least a few areas where performance could be improved through less redundancy in code.

Activity

  1. raghushantha commented on May 22, 2015

    @raghushantha
    Member

    Thanks for the suggestions, Kirk.

    For the first pass we will use Windows Performance Analyzer to make immediate perf improvements.

    -Raghu

  2. quoctruong commented on Jun 12, 2015

    @quoctruong

    Hi Kirk, do you mind providing me with a module where performance is an issue (would be great if you can let us know how long it takes too) ?

  3. KirkMunro commented on Jun 16, 2015

    @KirkMunro
    ContributorAuthor

    Hi Quoc,

    My DoPx module is where I found the worst performance (it has the largest number of files on the modules I tested). That is the module I was referring to above (where it took 1 minute 53 seconds to perform the analysis).

  4. quoctruong commented on Jun 16, 2015

    @quoctruong

    Thanks Kirk. We will look into this issue.

  5. quoctruong commented on Jun 18, 2015

    @quoctruong

    Fixed with #247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions