go/gopls/internal/regtest
Alan Donovan 63dfc2d3a9 internal/lsp/cache: two minor optimizations
1. Avoid unnecessary intermediate map updates.
2. Avoid accumulating defers in a loop when the control is simple.

Yield: -10% CPU, -37% allocs.

Typical results:

$ go test -v ./gopls/internal/regtest/bench -run=TestBenchmarkDidChange -didchange_dir=$HOME/w/kubernetes -didchange_file=pkg/util/hash/hash.go
Before:
BenchmarkStatistics	     100	  25932206 ns/op	11684109 B/op	   75458 allocs/op
After:
BenchmarkStatistics	     100	  23294195 ns/op	11293472 B/op	   47299 allocs/op

Also, move profiling logic outside the loop so that later runs
don't overwrite earlier runs. (This doesn't appear to be a problem
in practice, presumably because the last run is the big one.)

Updates golang/go#45686

Change-Id: I538ca6bb88cc18f1eefe35d2db29a62e5190280e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/410697
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-06 21:20:40 +00:00
..
bench internal/lsp/cache: two minor optimizations 2022-06-06 21:20:40 +00:00
codelens internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
completion internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
debug internal/lsp: add an option to get notified of bug reports 2022-05-18 01:40:46 +00:00
diagnostics internal/lsp/progress: detach context for all progress notifications 2022-06-02 20:26:04 +00:00
misc internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
modfile internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
template internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
watch internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00
workspace internal/lsp/cache: invalidate metadata when parsing issues resolve 2022-05-23 18:14:40 +00:00