Commit 1104a2af authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

strings: add IndexByte benchmark

Like existing Index, IndexRune, IndexHardN, etc.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486044
parent 12e46e42
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment