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

proposal: cmd/doc: improve performance by excluding node_modules #30058

Open
tj opened this Issue Feb 1, 2019 · 6 comments

Comments

Projects
None yet
6 participants
@tj
Copy link

tj commented Feb 1, 2019

@bradfitz mentioned go doc could special-case node_modules for exclusion.

If you have many client/server projects in $GOPATH, node_modules can quickly bloat and cause go doc to resolve slowly—this is especially noticeable in editors which use go doc to display inline documentation (see vscode issue).

I recursively removed my node_modules (15gb, crazy I know), here are the results before and after:

$ time go doc something

real    2m25.068s
user    0m17.772s
sys    1m45.039s

$ time go doc something

real    0m19.955s
user    0m2.499s
sys    0m9.343s

@tj tj changed the title cmd/doc: performance hindered greatly by node_modules cmd/doc: improve performance by excluding node_modules Feb 1, 2019

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Feb 1, 2019

/cc @robpike

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Feb 1, 2019

@bradfitz mentioned go doc could special-case node_modules for exclusion.

That was done as a result of #16417, which you opened in 2016 and is still open.

@bradfitz bradfitz added this to the Go1.13 milestone Feb 1, 2019

@mvdan

This comment has been minimized.

Copy link
Member

mvdan commented Feb 1, 2019

I presume this would extend the following bit of go help packages:

Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".

Or is it fine for go doc to skip certain directories, while other commands like go build and go test wouldn't?

@tj

This comment has been minimized.

Copy link
Author

tj commented Feb 2, 2019

Now that I think about it, gorename took ~5-10 minutes before as well, I'll have to try it now. It does seem a little hacky to special-case directories specific to some other language/framework, but I can't say I've ever wanted to operate against anything in node_modules either so it probably wouldn't be harmful

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Feb 2, 2019

To generalize this behavior, should we also ignore top-level directories under .gitignore ? That should take care of node_modules as well.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Feb 6, 2019

This can't be done in just cmd/doc. If we're going to do it, it should be globally, in cmd/go, go/build, etc. (And we can't start parsing .gitignore.)

It's unfortunate to have the definition of Go packages depending on or working around problems specific to other languages. On the other hand 15 GB is pretty big.

@rsc rsc changed the title cmd/doc: improve performance by excluding node_modules proposal: cmd/doc: improve performance by excluding node_modules Feb 6, 2019

@gopherbot gopherbot added the Proposal label Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment