Skip to content

Upgrade depguard to fix performance issue with go modules #698

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

Merged
merged 2 commits into from
Sep 15, 2019
Merged

Upgrade depguard to fix performance issue with go modules #698

merged 2 commits into from
Sep 15, 2019

Conversation

dixonwille
Copy link

Little insight on what I did. I timed depguard's Run method using depguard's cli alone. Before the fix it took on average a minute to go through golangci-lint repository. This does not include the time it took to build the loader. With the new fix in place it takes on average 3 milliseconds.

Before it was using go's build's context and the Import method on that. This killed time as I think it was doing a lot more than what I really needed. Instead, I am using build's context GOROOT and running iotuil.ReadDir to get the prefix for all known root packages. And if there is one thing depguard was good at, it was efficiently looking up prefixes from a slice.

Would love to hear your numbers as well.

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2019

CLA assistant check
All committers have signed the CLA.

@jirfag jirfag merged commit 9161de5 into golangci:master Sep 15, 2019
@jirfag
Copy link
Contributor

jirfag commented Sep 15, 2019

very cool, thank you!

@ldez ldez added the linter: update version Update version of linter label Dec 7, 2020
@ldez ldez added this to the v1.19 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linter: update version Update version of linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants