aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/cache/parse.go
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2022-06-14 14:15:04 -0400
committerAlan Donovan <adonovan@google.com>2022-06-15 15:41:53 +0000
commit654a14b5274602698564a5e9710c0778be664c7a (patch)
tree822132322082c044835539aec68ee8be29bb4d35 /internal/lsp/cache/parse.go
parent27db7f40b912ea6504f06b93c1776b67550729c4 (diff)
downloadgolang-x-tools-654a14b5274602698564a5e9710c0778be664c7a.tar.gz
internal/lsp/cache: reduce critical sections
This change reduces the sizes of the critical sections in traces.ProcessEvent and Generation.Bind, in particular moving allocations ahead of Lock. This reduces the contention according to the trace profiler. See https://go-review.googlesource.com/c/go/+/411909 for another reduction in contention. The largest remaining contention is Handle.Get, which thousands of goroutines wait for because we initiate typechecking top down. Also, add a couple of possible optimization TODO comments, and delete a stale comment re: Bind. Change-Id: I995a0bb46e8c9bf0c23492fb62b56f4539bc32f8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/411910 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Diffstat (limited to 'internal/lsp/cache/parse.go')
-rw-r--r--internal/lsp/cache/parse.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go
index 668c437f5..ab55743cc 100644
--- a/internal/lsp/cache/parse.go
+++ b/internal/lsp/cache/parse.go
@@ -278,7 +278,7 @@ func parseGo(ctx context.Context, fset *token.FileSet, fh source.FileHandle, mod
tok := fset.File(file.Pos())
if tok == nil {
- // file.Pos is the location of the package declaration. If there was
+ // file.Pos is the location of the package declaration (issue #53202). If there was
// none, we can't find the token.File that ParseFile created, and we
// have no choice but to recreate it.
tok = fset.AddFile(fh.URI().Filename(), -1, len(src))