diff options
Diffstat (limited to 'gopls/internal/regtest/bench/rename_test.go')
-rw-r--r-- | gopls/internal/regtest/bench/rename_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
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) + } +} |