| 1 |
// Copyright 2024 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package strings_test |
| 6 |
|
| 7 |
import ( |
| 8 |
. "strings" |
| 9 |
"testing" |
| 10 |
) |
| 11 |
|
| 12 |
func BenchmarkSplitSeqEmptySeparator(b *testing.B) { |
| 13 |
for range b.N { |
| 14 |
for range SplitSeq(benchInputHard, "") { |
| 15 |
} |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
func BenchmarkSplitSeqSingleByteSeparator(b *testing.B) { |
| 20 |
for range b.N { |
| 21 |
for range SplitSeq(benchInputHard, "/") { |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
func BenchmarkSplitSeqMultiByteSeparator(b *testing.B) { |
| 27 |
for range b.N { |
| 28 |
for range SplitSeq(benchInputHard, "hello") { |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
func BenchmarkSplitAfterSeqEmptySeparator(b *testing.B) { |
| 34 |
for range b.N { |
| 35 |
for range SplitAfterSeq(benchInputHard, "") { |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
func BenchmarkSplitAfterSeqSingleByteSeparator(b *testing.B) { |
| 41 |
for range b.N { |
| 42 |
for range SplitAfterSeq(benchInputHard, "/") { |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
func BenchmarkSplitAfterSeqMultiByteSeparator(b *testing.B) { |
| 48 |
for range b.N { |
| 49 |
for range SplitAfterSeq(benchInputHard, "hello") { |
| 50 |
} |
| 51 |
} |
| 52 |
} |