go/gopls/internal
Alan Donovan 3566f695a7 gopls/internal/lsp/source: minor space optimizations
Memory profiles show heavy allocation for the stack
and the function closure of FindDeclAndField.
This change moves both outside the loop, reducing
this function's fraction of allocation from 6.7%
before to 5.0% after, and reducing running time
by 3-7% on these benchmarks.

before
BenchmarkStructCompletion/completion-8               100          10432280 ns/op
BenchmarkImportCompletion/completion-8              1350            921785 ns/op
BenchmarkSliceCompletion/completion-8                100          10876852 ns/op
BenchmarkFuncDeepCompletion/completion-8             142           7136768 ns/op
BenchmarkCompletionFollowingEdit/completion-8         63          21267031 ns/op

After
BenchmarkStructCompletion/completion-8               100          10030458 ns/op
BenchmarkImportCompletion/completion-8              1311            918306 ns/op
BenchmarkSliceCompletion/completion-8                100          10179937 ns/op
BenchmarkFuncDeepCompletion/completion-8             150           6986303 ns/op
BenchmarkCompletionFollowingEdit/completion-8         63          20575987 ns/op

Change-Id: Ia459e41ecf20851ff4544f76ad7b415a24606cd1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/446185
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-10-31 19:44:01 +00:00
..
coverage gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
govulncheck gopls/internal/lsp: use the golang.org/x/vuln/exp/govulncheck 2022-10-11 21:42:28 +00:00
hooks gopls/internal/hooks: fixes to diff disaster logic 2022-10-27 00:23:26 +00:00
lsp gopls/internal/lsp/source: minor space optimizations 2022-10-31 19:44:01 +00:00
regtest gopls/internal/lsp: improve the Go version deprecation message 2022-10-27 13:53:43 +00:00
robustio internal/robustio: fix log.Fatal calls that should be log.Fatalf 2022-10-10 21:31:25 +00:00
span gopls/internal/lsp: tolerate missing end position in RelatedInformation 2022-10-19 18:04:39 +00:00
vulncheck gopls/internal/lsp: use the golang.org/x/vuln/exp/govulncheck 2022-10-11 21:42:28 +00:00
migrate.sh gopls/internal/migrate.sh: a script to migrate internal/lsp to gopls/ 2022-09-07 14:10:36 +00:00