Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

0.6.67 makes typing in a medium-sized project too laggy #1323

Closed
natefinch opened this issue Nov 8, 2017 · 6 comments
Closed

0.6.67 makes typing in a medium-sized project too laggy #1323

natefinch opened this issue Nov 8, 2017 · 6 comments

Comments

@natefinch
Copy link

I have a project that I would consider small to medium sized. The project itself is just a small API, but it does depend on a lot of other packages, which is why I say small to medium. Definitely not a huge behemoth like Kubernetes or Juju.

Typing is really laggy unless I set go.gocodeAutoBuild to false or disable the go plugin. This was not the case with the last version (though I haven't gone back to double check, to be fair.. but I would definitely have noticed this much lag).

It's like 200ms per character, even when deleting (it's most obvious when deleting, because that's easy to do fast, but if you type fast at all, you'll notice it).

I'm on OSX on a brand new macbook pro, so, it shouldn't be a hardware issue.

@natefinch
Copy link
Author

Possibly a duplicate of #1272, though I haven't seen stuck keys... what I type comes out correctly as far as I can tell, there's just major lag at times.

@tylerstillwater
Copy link
Contributor

Stuck keys could be something to do with my mechanical keyboard/driver/some other part of my system. Yours may just lag where mine repeats the key while it is lagging.

Regardless, I think the underlying issue is the same: the intellisense is blocking on a response from gocode.

@ramya-rao-a
Copy link
Contributor

The fact that this autoBuild feature can cause perf issues is not new. Luke had added the below note to the README when he added the completion feature to this extension

This extension uses gocode to provide completion lists as you type. To provide fresh results, including against not-yet-built dependencies, the extension uses gocode's autobuild=true setting. If you experience any performance issues with autocomplete, you should try setting "go.gocodeAutoBuild": false in your VS Code settings.

The maintainer of the gocode tool also calls this feature experimental

If true, gocode will try to automatically build out-of-date packages when their source files are modified, in order to obtain the freshest autocomplete results for them. This feature is experimental.

Now, to @tylerb's point and the issue of #1272: That is a general issue of not letting VS Code get stuck when gocode misbehaves.

To @natefinch's point that this is a regression in 0.6.67: I want to dig deeper here.

Recent changes in the completion area in the Go extension that can affect performance

  • To provide completions for symbols from unimported packages, the Go extension maintains list of all available packages under GOPATH. This is the only change in the completions area that can affect performance.
  • This list gets updated every 5 seconds or every completion request whichever is longer

With this, I can confidently say that there was nothing done in the recent release of the Go extension that could affect the performance of completions, especially the kind that gets solved by disabling the autobuild feature of gocode.

@natefinch Can you run a few experiments to compare the experience between the older and the newer versions of the extension?

  • Run gocode close before each experiment
  • Install Go 0.6.66 or Go 0.6.65 using the vsix files that you can get from the releases page: https://github.com/Microsoft/vscode-go/releases
  • To install run code --install-extension Go-0.6.66.vsix
  • Try both enabling and disabling the go.gocodeAutoBuild setting

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 8, 2017

Since about half a year now, the buildOnSave feature of the Go extension has been building Go packages using the -i flag that builds and installs stale dependencies. Before this, there was no way to ensure dependent packages were not stale which in turn lead to using the autobuild feature of gocode by default in the Go extension to ensure fresh results in completions.

At present, the only advantage of using the autobuild feature of gocode is for the scenario where user has disabled the buildOnSave feature or a dependency became stale before user saved the file.

With the -i flag now ensuring that dependent pkgs are never stale, I believe its time to disable the autoBuild feature of gocode by default. Users can still enable it via the setting go.gocodeAutoBuild

I didnt do this before as I wrongly assumed that completions from current package also depended on the autobuild feature to stay fresh (which I now know is not the case)

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 12, 2017

As explained in #1323 (comment), the auto build feature will be disabled by default.

@ramya-rao-a
Copy link
Contributor

In the latest update to the Go extension (0.6.69), the autobuild feature of gocode is disabled by default.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants