Skip to content
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

x/tools/gopls: 5x slowdown in cmd tests #37365

Closed
findleyr opened this issue Feb 21, 2020 · 3 comments
Closed

x/tools/gopls: 5x slowdown in cmd tests #37365

findleyr opened this issue Feb 21, 2020 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

While investigating #37318, I noticed that tests for golang.org/x/tools/internal/lsp/cmd were also timing out. For example: https://build.golang.org/log/a7e57b48b2eb87387651b04e268638d5b1b25f9d

Looking into this, it appears that cmd tests got significantly slower recently. Bisecting, it looks like this is a result of golang/tools@6dcdf1d. These tests went from ~6s to ~30s on my workstation. That's surprising.

[nyc:tools2]> go test -count=1 ./internal/lsp/cmd                                                                     
ok      golang.org/x/tools/internal/lsp/cmd     5.937s                                                                
[nyc:tools2]> git bisect good                                                                                         
6dcdf1db2c06ad0ebe311c58b8cda17392eb42c2 is the first bad commit
commit 6dcdf1db2c06ad0ebe311c58b8cda17392eb42c2
Author: Rebecca Stambler <rstambler@golang.org>
Date:   Thu Jan 30 21:29:41 2020 -0500
                                                           
    internal/lsp/cache: refactor functions that return PackageHandles

CC @stamblerre @ianthehat

@gopherbot gopherbot added this to the Unreleased milestone Feb 21, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 21, 2020
@golang golang deleted a comment from gopherbot Feb 21, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Feb 21, 2020
@findleyr
Copy link
Contributor Author

Highlight tests appear to be the main contributors to the slowdown. For example:

nyc:tools2]> go test -run=TestCommandLine/Modules/../testdata/lsp/Highlight -count=1 ./internal/lsp/cmd
ok      golang.org/x/tools/internal/lsp/cmd     12.115s
[nyc:tools2]> git checkout HEAD~1
Previous HEAD position was 6dcdf1db internal/lsp/cache: refactor functions that return PackageHandles
HEAD is now at 009580c4 internal/lsp/source: export FindFileInpackage
[nyc:tools2]> go test -run=TestCommandLine/Modules/../testdata/lsp/Highlight -count=1 ./internal/lsp/cmd
ok      golang.org/x/tools/internal/lsp/cmd     2.363s

@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 26, 2020
@ridersofrohan
Copy link

go test -run=TestCommandLine/Modules/../testdata/lsp/Highlight -count=1 ./internal/lsp/cmd

Ran this test with some logging to see how long segments of code take to run and the part that takes up the most amount of time is running packages.load, which takes on average 200ms. The main difference is that now running this test calls packages.load 52 times, once for each highlight marker.

@gopherbot
Copy link

Change https://golang.org/cl/221107 mentions this issue: internal/lsp: remove unknown dependency from highlight tests

@golang golang locked and limited conversation to collaborators Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants