aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gopls/internal/regtest/bench/definition_test.go22
-rw-r--r--gopls/internal/regtest/bench/editor_features_test.go83
-rw-r--r--gopls/internal/regtest/bench/hover_test.go23
-rw-r--r--gopls/internal/regtest/bench/implementations_test.go21
-rw-r--r--gopls/internal/regtest/bench/references_test.go22
-rw-r--r--gopls/internal/regtest/bench/rename_test.go25
6 files changed, 113 insertions, 83 deletions
diff --git a/gopls/internal/regtest/bench/definition_test.go b/gopls/internal/regtest/bench/definition_test.go
new file mode 100644
index 000000000..20b75de73
--- /dev/null
+++ b/gopls/internal/regtest/bench/definition_test.go
@@ -0,0 +1,22 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bench
+
+import "testing"
+
+func BenchmarkGoToDefinition(b *testing.B) {
+ env := sharedEnv(b)
+
+ env.OpenFile("internal/imports/mod.go")
+ loc := env.RegexpSearch("internal/imports/mod.go", "ModuleJSON")
+ env.GoToDefinition(loc)
+ env.Await(env.DoneWithOpen())
+
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ env.GoToDefinition(loc)
+ }
+}
diff --git a/gopls/internal/regtest/bench/editor_features_test.go b/gopls/internal/regtest/bench/editor_features_test.go
deleted file mode 100644
index f27132c45..000000000
--- a/gopls/internal/regtest/bench/editor_features_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2022 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package bench
-
-import (
- "fmt"
- "testing"
-)
-
-func BenchmarkGoToDefinition(b *testing.B) {
- env := sharedEnv(b)
-
- env.OpenFile("internal/imports/mod.go")
- loc := env.RegexpSearch("internal/imports/mod.go", "ModuleJSON")
- env.GoToDefinition(loc)
- env.Await(env.DoneWithOpen())
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- env.GoToDefinition(loc)
- }
-}
-
-func BenchmarkFindAllReferences(b *testing.B) {
- env := sharedEnv(b)
-
- env.OpenFile("internal/imports/mod.go")
- loc := env.RegexpSearch("internal/imports/mod.go", "gopathwalk")
- env.References(loc)
- env.Await(env.DoneWithOpen())
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- env.References(loc)
- }
-}
-
-func BenchmarkRename(b *testing.B) {
- env := sharedEnv(b)
-
- env.OpenFile("internal/imports/mod.go")
- env.Await(env.DoneWithOpen())
-
- b.ResetTimer()
-
- for i := 1; i < b.N; i++ {
- loc := env.RegexpSearch("internal/imports/mod.go", "gopathwalk")
- newName := fmt.Sprintf("%s%d", "gopathwalk", i)
- env.Rename(loc, newName)
- }
-}
-
-func BenchmarkFindAllImplementations(b *testing.B) {
- env := sharedEnv(b)
-
- env.OpenFile("internal/imports/mod.go")
- loc := env.RegexpSearch("internal/imports/mod.go", "initAllMods")
- env.Await(env.DoneWithOpen())
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- env.Implementations(loc)
- }
-}
-
-func BenchmarkHover(b *testing.B) {
- env := sharedEnv(b)
-
- env.OpenFile("internal/imports/mod.go")
- loc := env.RegexpSearch("internal/imports/mod.go", "bytes")
- env.Await(env.DoneWithOpen())
-
- b.ResetTimer()
-
- for i := 0; i < b.N; i++ {
- env.Hover(loc)
- }
-}
diff --git a/gopls/internal/regtest/bench/hover_test.go b/gopls/internal/regtest/bench/hover_test.go
new file mode 100644
index 000000000..78fdc930a
--- /dev/null
+++ b/gopls/internal/regtest/bench/hover_test.go
@@ -0,0 +1,23 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bench
+
+import (
+ "testing"
+)
+
+func BenchmarkHover(b *testing.B) {
+ env := sharedEnv(b)
+
+ env.OpenFile("internal/imports/mod.go")
+ loc := env.RegexpSearch("internal/imports/mod.go", "bytes")
+ env.Await(env.DoneWithOpen())
+
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ env.Hover(loc)
+ }
+}
diff --git a/gopls/internal/regtest/bench/implementations_test.go b/gopls/internal/regtest/bench/implementations_test.go
new file mode 100644
index 000000000..610a2d28c
--- /dev/null
+++ b/gopls/internal/regtest/bench/implementations_test.go
@@ -0,0 +1,21 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bench
+
+import "testing"
+
+func BenchmarkFindAllImplementations(b *testing.B) {
+ env := sharedEnv(b)
+
+ env.OpenFile("internal/imports/mod.go")
+ loc := env.RegexpSearch("internal/imports/mod.go", "initAllMods")
+ env.Await(env.DoneWithOpen())
+
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ env.Implementations(loc)
+ }
+}
diff --git a/gopls/internal/regtest/bench/references_test.go b/gopls/internal/regtest/bench/references_test.go
new file mode 100644
index 000000000..e5f1f63df
--- /dev/null
+++ b/gopls/internal/regtest/bench/references_test.go
@@ -0,0 +1,22 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bench
+
+import "testing"
+
+func BenchmarkReferences(b *testing.B) {
+ env := sharedEnv(b)
+
+ env.OpenFile("internal/imports/mod.go")
+ loc := env.RegexpSearch("internal/imports/mod.go", "gopathwalk")
+ env.References(loc)
+ env.Await(env.DoneWithOpen())
+
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ env.References(loc)
+ }
+}
diff --git a/gopls/internal/regtest/bench/rename_test.go b/gopls/internal/regtest/bench/rename_test.go
new file mode 100644
index 000000000..e6db663a4
--- /dev/null
+++ b/gopls/internal/regtest/bench/rename_test.go
@@ -0,0 +1,25 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bench
+
+import (
+ "fmt"
+ "testing"
+)
+
+func BenchmarkRename(b *testing.B) {
+ env := sharedEnv(b)
+
+ env.OpenFile("internal/imports/mod.go")
+ env.Await(env.DoneWithOpen())
+
+ b.ResetTimer()
+
+ for i := 1; i < b.N; i++ {
+ loc := env.RegexpSearch("internal/imports/mod.go", "gopathwalk")
+ newName := fmt.Sprintf("%s%d", "gopathwalk", i)
+ env.Rename(loc, newName)
+ }
+}