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

Perfomance downgrade when using "go module" mode #2251

Closed
sashker opened this issue Jan 15, 2019 · 22 comments
Closed

Perfomance downgrade when using "go module" mode #2251

sashker opened this issue Jan 15, 2019 · 22 comments
Labels
go-modules Related to Go modules

Comments

@sashker
Copy link

sashker commented Jan 15, 2019

Hello.

I saw similar tickets and they were closed (probably #2217) but I can state that difference in performance with modules and without is dramatic.

Having go.mod and go.sum within a project directory, I might wait for auto complete and other functions up to 3 seconds. Simply removing go.sum and go.mod makes VS works as usual pretty quickly.

Testing project is quite small (around 1000 strings) though use many dependencies.

Go version: 1.11.4
Platform: darwin

@eknkc
Copy link

eknkc commented Jan 15, 2019

This is also what I see. Due to the unusable performance I use go mod vendor to vendor in any dependencies and use vscode in non-module way. Go cli still uses the modules.

The exact same project with modules enabled is significantly slower (to the point that it's unusable) in code completion / reference lookups etc.

@sysulq
Copy link

sysulq commented Jan 16, 2019

+1

@abdullahsaleem93
Copy link

+1 becomes almost unusable

@eknkc
Copy link

eknkc commented Jan 16, 2019

BTW, just checked the language server stuff. bingo seems to be working fine with decent performance. However saibing/bingo#54 is kind of a deal breaker for me. I guess the language servers are the way to go in future development?

@sashker
Copy link
Author

sashker commented Jan 16, 2019

I tried recommended language server by Sourcegraph but it doesn't eliminate the problem. I believe that we have to wait until the upcoming server from Google.
Anyway, I'd love to understand what causes such a problem.

@OneOfOne
Copy link
Contributor

OneOfOne commented Jan 16, 2019

@sashker sourcegraph lsp is mostly dead / maintained, I recommend using bingo.

	"go.alternateTools": {
		"go-langserver": "bingo"
	},
	"go.useLanguageServer": true,
	"go.languageServerFlags": ["-format-style=goimports"],
	"go.languageServerExperimentalFeatures": {
		"format": true,
		"autoComplete": true,
		"rename": true,
		"goToDefinition": true,
		"hover": true,
		"signatureHelp": true,
		"goToTypeDefinition": true,
		"goToImplementation": true,
		"documentSymbols": true,
		"workspaceSymbols": true,
		"findReferences": true
	},

@eknkc a simple workaround would be typing the package name and saving (while "go.languageServerFlags": ["-format-style=goimports"] is set to get it imported, I know it's inconvenient but it's still way better than the alternative.

@eknkc
Copy link

eknkc commented Jan 16, 2019

@sashker thanks, I tried doing that but it won't simply import the package via package name, it needs a full signature. For example entering spew and saving does nothing, spew.Dump imports the package. This means I need to know at least one publicly accessible variable or function.

BTW, I believe your sample config needs this for bingo:

  "go.alternateTools": {
    "go-langserver": "bingo"
  }

I also see this sometimes (not reliable):

I wonder if it's coming from the language server or another tool integrated into vscode-go.

@OneOfOne
Copy link
Contributor

I forgot to paste that part, not fully awake yet :)

@ramya-rao-a
Copy link
Contributor

A few notes:

  • Yes, language server is the way for future delvelopment, and we are hoping that the one from Google would cater to both module and GOPATHs
  • The Go language server by Sourcegraph does not support modules and has stopped adding new features
  • If you want to use bingo as your language server, install it and then follow the settings in Perfomance downgrade when using "go module" mode #2251 (comment)
  • If you are not using the language server and are seeing slowness in auto-completion, please log an issue at https://github.com/stamblerre/gocode

@segevfiner
Copy link
Contributor

I wonder if this is related golang/go#29427.

@CMGS
Copy link

CMGS commented Mar 26, 2019

+1

@ramya-rao-a ramya-rao-a added the go-modules Related to Go modules label Mar 27, 2019
@lucashtc
Copy link

lucashtc commented Apr 2, 2019

+1 becomes almost unusable

@ramya-rao-a
Copy link
Contributor

Hello everyone,
Thanks for your patience.

Please install the latest beta version (0.9.3-beta.7) of this extension.
I'll be releasing the same in the next update to the extension early next week. #2410 is the test plan for the next update if anyone is interested.

The beta version will prompt you to use gopls, the language server from Google if it detects that you are using Go modules. Please install and use the language server. It performs much better especially for auto-completions.

This was the long term plan for module support. Therefore, closing this issue.

If you find any other performance issue while using gopls, please log new issues.

Thanks again and Happy Coding!

@sysulq
Copy link

sysulq commented Apr 3, 2019

nice job

@Helcaraxan
Copy link

Having switched to using bingo a few days ago I can confirm that the language servers are really fast, even if they are still in their infancy and will require quite a lot of polishing.

Autocomplete is back at its usual speed. And renaming symbols is actually 100x faster (as in instantaneous). You can also now rename symbols on non-compiling files which we couldn't before.

Next pet-pieve (but which is not this extension's issue): loading times of my very large project with the language server which is now ~8 minutes.

@wooque
Copy link

wooque commented Apr 3, 2019

bingo is currently better than gopls
It uses less memory and has more features (supports renaming symbols for example)

@glerchundi
Copy link

As stated on the bingos readme:

Note
I am very sorry that I have planned not continue to maintain this project.

According to the issue #13 collaborating on golsp, I hope that we will eventually have a unified language server: gopls.

It is Google's upcoming Go language server. It is in the best interests of the community to only have a single language server.

I have ported some features such as references, rename, workspace symbol, implementation of bingo to gopls.

If you want to use the enhanced version of gopls, try https://github.com/saibing/tools.

@treeder
Copy link

treeder commented Apr 3, 2019

@ramya-rao-a there's no vsix file here to install: https://github.com/Microsoft/vscode-go/releases/tag/latest

@ramya-rao-a
Copy link
Contributor

@treeder Thanks for letting me know, I must have clicked the "Publish Release" button before the upload was complete. The release is updated now.

All, please read the section on language servers at https://github.com/Microsoft/vscode-go/blob/8ea6e4708dfd141ab65b4c7eb4f71e55d098a222/README.md#go-language-server-experimental as well.

@treeder
Copy link

treeder commented Apr 3, 2019

😮 wow, this is like night and day, sooooooo much better. It's basically instant now whereas it was taking like 5 seconds to click through references before. Nice work!

@sevein
Copy link

sevein commented Apr 6, 2019

Wow, using useLanguageServer and gopls.
So fast! My old laptop and I thank you very much.

@kyleferguson
Copy link

Mine was also super slow and using the beta version mentioned by @ramya-rao-a and the gopls language server (which auto requests to be installed when you edit a go file after adding the beta version) fixed the issues for me. Thanks!!

@vscodebot vscodebot bot locked and limited conversation to collaborators May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-modules Related to Go modules
Projects
None yet
Development

No branches or pull requests