-
Notifications
You must be signed in to change notification settings - Fork 141
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
godef takes ~2 seconds when used with go modules #114
Comments
i had the same issue, try reinstall the godef using GO111MODULE=on environment variable.
|
@ysoftman I don't think your recommendation helped (in fact it made the execution time worse for some reason). Given the repro I provided above, I ran these additional commands:
the command above now takes somewhere between 3.3s and 5.5s per invocation. |
I've also seen massive latency increases on godef services since moving outside the gopath as part of the gomod update. |
Taking a quick look at this this morning (as this has also started hitting me in vscode):
My first run (OSX 2017 MBP) with @ahmetb's test case took 2 seconds, but subsequent runs took 0.4s, most of that in system. I haven't been able to reliably make it take multiple seconds again regardless of which offset I use. I note that 0.3-0.5s is consistent for runs using the new implementation, whereas the old implementation is between 0.05 and 0.1s for me. Running Looking at the source for |
Okay. Deleting GOMODENABLE=on go get -u github.com/rogpeppe/godef
go get -u github.com/rogpeppe/godef
Note that specifying |
Confirming: If I put within go path, go.mod/sum removed
|
A half-day of deep diving later:
Looking through the traces and so forth shows lots of file opens & reads, even when the build cache is used. My guess is that godef's original implementation could afford to be quite specialised about what it interrogated, and was thus fast. As the current implementation depends on external (and more generic purpose) tooling, that tooling could potentially be doing a lot more than it otherwise needs to be doing to get the information that godef needs. |
|
godef
seems to be unusually slow when used in a project using Go modules. This is making vscode-go extension slower.Here's a repro that depends on 1 external module (and some more packages indirectly) and it takes ~1.7-3 seconds:
this cursor position is a method in a directly imported package
@rogpeppe @ianthehat
The text was updated successfully, but these errors were encountered: