gopls performance question

341 views
Skip to first unread message

Luke Mauldin

unread,
Jul 3, 2020, 3:43:53 PM7/3/20
to golang-nuts
I have a Go project that is relatively small in terms of number of files (less than 30) but some Go files have auto-generated code that makes them relatively large - some between 3-4 MB.  I counted the SLOC using https://github.com/hhatto/gocloc and it reports about 61K lines of code and 40K lines of comments.  When I am using `gopls` in my project on a pretty high-end workstation (Intel Xeon W-2135, 32 GB RAM, SSD hard drive), it is taking 4-5 seconds to give autocomplete suggestions in VSCode.  Do you have any recommendations of ways to improve the auto complete time?  
Of note, one of the subdirectories of the project is a package that uses CGO and it is wrapping about 440 C method calls.  If it would help, I can move that subdirectory into its own package entirely and reference it via go.mod?  

Please let me know if you have any suggestions or if I should post this in the `gopls` Github project.

Luke

Luke Mauldin

unread,
Jul 3, 2020, 4:12:59 PM7/3/20
to golang-nuts
To add a bit more information to this topic: I also have Vim + ale + gopls setup and I tried the same file with Vim + gopls auto complete and it was much faster in Vim.  Based on my rough timing, I got the correct auto complete responses from gopls in Vim in about 1.5 seconds vs about 4-5 seconds in VSCode.  I am using VSCode 1.46.1 on Linux.  Could this in some way be a VSCode issue instead of gopls?

Luke Mauldin

unread,
Jul 8, 2020, 9:34:17 AM7/8/20
to golang-nuts
To follow up, I did submit an issue and it is related to a bug in gopls: https://github.com/golang/vscode-go/issues/299
Reply all
Reply to author
Forward
0 new messages