Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed #3925

Open
tbarbugli opened this issue Jun 26, 2023 · 6 comments
Open

Speed #3925

tbarbugli opened this issue Jun 26, 2023 · 6 comments

Comments

@tbarbugli
Copy link

tbarbugli commented Jun 26, 2023

Your feature request related to a problem? Please describe.

Golangci-lint is much slower than the linters it wraps

Describe the solution you'd like.

I think the shared analysis step makes sense but it seems to be incredibly slow, I see a 20x slow down between gocritic and the same with Golangci-lint

Describe alternatives you've considered.

Tried tuning params of all kinds, unfortunately, I have no time to dive into it more than that

Additional context.

No response

@tbarbugli tbarbugli added the enhancement New feature or improvement label Jun 26, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 26, 2023

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez
Copy link
Member

ldez commented Jun 26, 2023

Hello,

Can you provide a reproducible context?

golangci-lint --version
cat .golangci.yml
go version && go env
golangci-lint cache clean
golangci-lint run -v

and a public repository.

@ldez ldez added the feedback required Requires additional feedback label Jun 26, 2023
@guerinoni
Copy link

Tested on repo docker/compose

√ compose v2 % time gocritic check
gocritic check  0.37s user 0.16s system 177% cpu 0.297 total
√ compose v2 % golangci/1.52.2/golangci-lint cache clean
√ compose v2 % time golangci/1.52.2/golangci-lint run
golangci/1.52.2/golangci-lint run  1.79s user 1.50s system 231% cpu 1.421 total
run:
  concurrency: 2
  timeout: 10m
linters:
  enable-all: false
  disable-all: true
  enable:
    - gocritic
  gocritic:
    enabled-tags:
      - diagnostic
      - opinionated
      - style
    disabled-checks:
      - paramTypeCombine
      - unnamedResult
      - whyNoLint

@ldez
Copy link
Member

ldez commented Jul 7, 2023

The performance of linters cannot be analyzed one by one because golangci-lint creates a cache to optimize the run of several linters.
So yes for one specific linter, it can be slower.

@guerinoni
Copy link

Right now I simplify the config for creating a good example, in our project (I work with tbarbugli) we have more complex situation, then I don't know how to spot the issues

@nielskrijger
Copy link

Seeing the same issue with gocritic, disabling it reduced our lint time (on a modern macbook) from 95s to 30s.

Interestingly, the diagnostic tag didn't seem to impact performance much, the other gocritic tags appear to slow down execution time to varying degree.

@ldez ldez added topic: speed and removed enhancement New feature or improvement feedback required Requires additional feedback labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants