diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go index f4c0ffd2a91..80a54f6118b 100644 --- a/src/bytes/bytes_test.go +++ b/src/bytes/bytes_test.go @@ -1642,6 +1642,16 @@ func makeBenchInputHard() []byte { var benchInputHard = makeBenchInputHard() +func benchmarkLastIndexHard(b *testing.B, sep []byte) { + for i := 0; i < b.N; i++ { + LastIndex(benchInputHard, sep) + } +} + +func BenchmarkLastIndexHard1(b *testing.B) { benchmarkLastIndexHard(b, []byte("<>")) } +func BenchmarkLastIndexHard2(b *testing.B) { benchmarkLastIndexHard(b, []byte("")) } +func BenchmarkLastIndexHard3(b *testing.B) { benchmarkLastIndexHard(b, []byte("hello world")) } + func BenchmarkSplitEmptySeparator(b *testing.B) { for i := 0; i < b.N; i++ { Split(benchInputHard, nil)