You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
gopls-CI: kokoro <[email protected]>
Run-TryBot: Alan Donovan <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
0 commit comments