GoSublime icon indicating copy to clipboard operation
GoSublime copied to clipboard

GoSublime: browse declarations and browse packages no response

Open jackie-qiu opened this issue 8 years ago • 8 comments

There is no response when execute GoSublime: browse declarations and GoSublime: browse packages.The MarGo is pending at the "fetching pkg dirs" status. ** 2017-02-22 12:19:41.466289 **: GoSublime init r17.02.16-1 (0.001s) | install margo: no | install state: done | sublime.version: 3126 | sublime.channel: stable | about.ann: a17.02.16-1 | about.version: r17.02.16-1 | version: r17.02.16-1 | platform: osx-x64 | ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin | margo.exe: ~bin/gosublime.margo_r17.02.16-1_go1.8.exe (ok) | go.exe: /usr/local/opt/go/libexec/bin/go (ok) | go.version: go1.8 | GOROOT: /usr/local/opt/go/libexec | GOPATH: ~/Work/code/goroot | GOBIN: (not set) (should usually be (not set)) | set.shell: [] | env.shell: /bin/zsh | shell.cmd: ['/bin/zsh', '-l', '-c', '${CMD}']

image

jackie-qiu avatar Feb 22 '17 04:02 jackie-qiu

Same for me... just hangs.

baloo32 avatar Nov 13 '18 07:11 baloo32

Is go list all also slow?

DisposaBoy avatar Nov 28 '18 15:11 DisposaBoy

go list all - 1 minute 14 seconds GoSublime browse packages (Warm) - 8 seconds GoSublime browse packages (Cold) - 2 minutes 13 seconds

So assume this is just the time it takes to parse the packages for first time.

baloo32 avatar Nov 30 '18 09:11 baloo32

Thanks @baloo32, is there any way I might be able to reproduce this?

  • Do you have large repos in GOPATH? any that I can clone?
  • Do you have lots of non-go files e.g. node_modules?
  • EDIT: Is this on SSD, HDD?
  • EDIT: Roughly how many files are in GOPATH?

What's the slowest run of go list ./... inside GOROOT and each entry in GOPATH? The current version of margo scans GOROOT and GOPATH in parallel so it should take only slightly longer than the slowest directory but I'm exploring faster ways to do said scanning before I port the package browsing over.

DisposaBoy avatar Dec 01 '18 09:12 DisposaBoy

GOPATH directory contains 49 different repos, including our main work project - only in our own do we have lots of no .go files - as suggested, bulk is node_modules (using Angular for front end).

Hosted on secondary SSD drive.

Files in GOPATH: image Files excluding the project with node_modules: 8,082 files, 3,077 folders ~178Mb

List of packages in use: image

go list ./... in GOROOT = 39 seconds go list ./... in GOPATH = 1 minute 8 seconds

Hope that helps.

baloo32 avatar Dec 05 '18 16:12 baloo32

Thanks @baloo32.

For comparison:

Inside my GOROOT on Linux with i/o caches cleared I get ~5s from go list. Inside GOPATH with a lot of junk, go list is ~35s while my planned new solution using godirwalk is ~24s (~3s warm) with the actually directory traversal taking ~8s (~1.5s warm).

At the moment you can see the timings in the Sublime Text console at startup in line like margo:...Scan GOPATH...packages=123, list=12.3s. That timing is with go list so the planned solution will be faster and hopefully enables lazy loading of the package data which will also be cached so package browsing should take little to no extra time since many of the packages are already being loaded by autocompletion, etc.

We might also be able to speed it up more by skipping directories like node_modules.

DisposaBoy avatar Dec 05 '18 18:12 DisposaBoy

Update: the new code (still experimental, with little testing) is on the next branch. It's not being used yet, but it's running at startup and prints timings in the Sublime Text console like margocode.go: VFS.Scan.....

DisposaBoy avatar Dec 07 '18 19:12 DisposaBoy

After a bunch of optimization and experimentation, the junk GOPATH preloading is now ~10s (~1.5s warm) and GOROOT is ~350ms (~80ms warm).

If we need to re-scan the whole directory tree again e.g. due to running go get, that takes ~400ms and ~20ms respectively.

DisposaBoy avatar Dec 25 '18 13:12 DisposaBoy