Skip to content

Invoke-PSScriptAnalyzer performance is very, very poor #197

Closed
@KirkMunro

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions