Source file src/bytes/iter_test.go

     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 bytes_test
     6  
     7  import (
     8  	. "bytes"
     9  	"testing"
    10  )
    11  
    12  func BenchmarkSplitSeqEmptySeparator(b *testing.B) {
    13  	for range b.N {
    14  		for range SplitSeq(benchInputHard, nil) {
    15  		}
    16  	}
    17  }
    18  
    19  func BenchmarkSplitSeqSingleByteSeparator(b *testing.B) {
    20  	sep := []byte("/")
    21  	for range b.N {
    22  		for range SplitSeq(benchInputHard, sep) {
    23  		}
    24  	}
    25  }
    26  
    27  func BenchmarkSplitSeqMultiByteSeparator(b *testing.B) {
    28  	sep := []byte("hello")
    29  	for range b.N {
    30  		for range SplitSeq(benchInputHard, sep) {
    31  		}
    32  	}
    33  }
    34  
    35  func BenchmarkSplitAfterSeqEmptySeparator(b *testing.B) {
    36  	for range b.N {
    37  		for range SplitAfterSeq(benchInputHard, nil) {
    38  		}
    39  	}
    40  }
    41  
    42  func BenchmarkSplitAfterSeqSingleByteSeparator(b *testing.B) {
    43  	sep := []byte("/")
    44  	for range b.N {
    45  		for range SplitAfterSeq(benchInputHard, sep) {
    46  		}
    47  	}
    48  }
    49  
    50  func BenchmarkSplitAfterSeqMultiByteSeparator(b *testing.B) {
    51  	sep := []byte("hello")
    52  	for range b.N {
    53  		for range SplitAfterSeq(benchInputHard, sep) {
    54  		}
    55  	}
    56  }
    57  

View as plain text