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

gogetdoc is extremly slow on code that is using cgo #47

Open
segevfiner opened this issue Nov 3, 2018 · 2 comments
Open

gogetdoc is extremly slow on code that is using cgo #47

segevfiner opened this issue Nov 3, 2018 · 2 comments

Comments

@segevfiner
Copy link

segevfiner commented Nov 3, 2018

gogetdoc seems to invoke cgo, which invokes the native compiler, which can be quite slow. It does this for every invocation, with no caching, even if there were no changes in the cgo code. This ends up making gogetdoc so slow that it is unusable when you have such a package in your dependency graph.

Steps to reproduce

You need to have ImageMagick available. (See https://github.com/gographics/imagick)

  1. Save the following as main.go in a new go package directory:
package main

import "gopkg.in/gographics/imagick.v2/imagick"

func main() {
	imagick.Initialize()
}
  1. dep init.
  2. gogetdoc -pos main.go:#87.

Related

microsoft/vscode-go#667 microsoft/vscode-go#1025

cc @ramya-rao-a

@zmb3
Copy link
Owner

zmb3 commented Nov 3, 2018

Thanks for the repro - I will take a look.
gogetdoc doesn't actually support cgo but it's possible that go/packages is doing something related.

@segevfiner
Copy link
Author

Thanks for the repro - I will take a look.
gogetdoc doesn't actually support cgo but it's possible that go/packages is doing something related.

It's probably go list -compiled used internally by go/packages. golang/tools/go/packages/golist.go#L630.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants