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
internal/golang: add a fast path for FormatVarType with gopls at 1.23
Now that gopls is only built with Go 1.23, we can rely on
types.TypeString to preserve alias information, and only need the
bespoke logic of FormatVarType to handle the cases where types contain
an invalid type.
This should improve performance for completion, particularly since it
affects the single-threaded construction of candidates.
For example, here is the impact on a relevant benchmark:
Completion/kubernetes_selector/edit=false/unimported=false/budget=100ms
Results:
│ before.txt │ after.txt │
│ sec/op │ sec/op vs base │
81.29m ± 1% 65.83m ± 1% -19.02% (p=0.000 n=10)
│ before.txt │ after.txt │
│ cpu_seconds/op │ cpu_seconds/op vs base │
151.8m ± 15% 101.1m ± 33% -33.36% (p=0.000 n=10)
Change-Id: I60d890ca102a97cf6b198621ba82afe7eeab7fb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611836
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Robert Findley <[email protected]>
Reviewed-by: Alan Donovan <[email protected]>
Copy file name to clipboardExpand all lines: gopls/internal/test/marker/testdata/completion/foobarbaz.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -476,7 +476,7 @@ func _() {
476
476
477
477
const two = 2
478
478
var builtinTypes func([]int, [two]bool, map[string]string, struct{ i int }, interface{ foo() }, <-chan int)
479
-
builtinTypes = f //@snippet(" //", litFunc, "func(i1 []int, b [two]bool, m map[string]string, s struct{i int\\}, i2 interface{foo()\\}, c <-chan int) {$0\\}")
479
+
builtinTypes = f //@snippet(" //", litFunc, "func(i1 []int, b [2]bool, m map[string]string, s struct{i int\\}, i2 interface{foo()\\}, c <-chan int) {$0\\}")
480
480
481
481
var _ func(ast.Node) = f //@snippet(" //", litFunc, "func(n ast.Node) {$0\\}")
482
482
var _ func(error) = f //@snippet(" //", litFunc, "func(err error) {$0\\}")
0 commit comments