mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
strings: add IndexByte benchmark
Like existing Index, IndexRune, IndexHardN, etc. R=golang-dev, khr CC=golang-dev https://golang.org/cl/12486044
This commit is contained in:
parent
12e46e42ec
commit
1104a2afb1
1 changed files with 9 additions and 0 deletions
|
|
@ -168,6 +168,15 @@ func BenchmarkIndex(b *testing.B) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkIndexByte(b *testing.B) {
|
||||
if got := IndexByte(benchmarkString, 'v'); got != 17 {
|
||||
b.Fatalf("wrong index: expected 17, got=%d", got)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
IndexByte(benchmarkString, 'v')
|
||||
}
|
||||
}
|
||||
|
||||
var explodetests = []struct {
|
||||
s string
|
||||
n int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue