Skip to content

Improve performance of bidichk #43

@pkwarren

Description

@pkwarren

We noticed of all the analyzers we have enabled in golangci-lint, the bidichk one was consuming the most time. This was a bit surprising, but I believe I've identified the reason for the performance issue.

The analyzer is iterating over analysis.Pass.Fset (which contains all imports including the go stdlib and module dependencies) in addition to the files found in the specified packages. It appears it should be updated to only run on analysis.Pass.Files instead.

Additionally, using Fset will mean that for files imported by multiple packages, the analyzer will process the same files multiple times.

After enabling a fix for this locally, the runtime of the analyzer dropped from 76.29s to 4.71s in our moderately sized project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions