mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
|
|
// Copyright 2024 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 bytes_test
|
||
|
|
|
||
|
|
import (
|
||
|
|
. "bytes"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func BenchmarkSplitSeqEmptySeparator(b *testing.B) {
|
||
|
|
for range b.N {
|
||
|
|
for range SplitSeq(benchInputHard, nil) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkSplitSeqSingleByteSeparator(b *testing.B) {
|
||
|
|
sep := []byte("/")
|
||
|
|
for range b.N {
|
||
|
|
for range SplitSeq(benchInputHard, sep) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkSplitSeqMultiByteSeparator(b *testing.B) {
|
||
|
|
sep := []byte("hello")
|
||
|
|
for range b.N {
|
||
|
|
for range SplitSeq(benchInputHard, sep) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkSplitAfterSeqEmptySeparator(b *testing.B) {
|
||
|
|
for range b.N {
|
||
|
|
for range SplitAfterSeq(benchInputHard, nil) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkSplitAfterSeqSingleByteSeparator(b *testing.B) {
|
||
|
|
sep := []byte("/")
|
||
|
|
for range b.N {
|
||
|
|
for range SplitAfterSeq(benchInputHard, sep) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func BenchmarkSplitAfterSeqMultiByteSeparator(b *testing.B) {
|
||
|
|
sep := []byte("hello")
|
||
|
|
for range b.N {
|
||
|
|
for range SplitAfterSeq(benchInputHard, sep) {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|