mirror of https://github.com/golang/go.git
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> |
||
|---|---|---|
| .. | ||
| coverage | ||
| govulncheck | ||
| hooks | ||
| lsp | ||
| regtest | ||
| robustio | ||
| span | ||
| vulncheck | ||
| migrate.sh | ||