Commit 9a7ce41d authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

bytes: cut 10 seconds off the race builder's benchmark test

Don't benchmark so many sizes during the race builder's benchmark run.

This package doesn't even use goroutines.

Cuts off 10 seconds.

Updates #17104

Change-Id: Ibb2c7272c18b9014a775949c656a5b930f197cd4
Reviewed-on: https://go-review.googlesource.com/29158Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
parent f09d0458
......@@ -7,8 +7,10 @@ package bytes_test
import (
. "bytes"
"fmt"
"internal/testenv"
"math/rand"
"reflect"
"strings"
"testing"
"unicode"
"unicode/utf8"
......@@ -384,6 +386,9 @@ func valName(x int) string {
func benchBytes(b *testing.B, sizes []int, f func(b *testing.B, n int)) {
for _, n := range sizes {
if isRaceBuilder && n > 4<<10 {
continue
}
b.Run(valName(n), func(b *testing.B) {
if len(bmbuf) < n {
bmbuf = make([]byte, n)
......@@ -396,6 +401,8 @@ func benchBytes(b *testing.B, sizes []int, f func(b *testing.B, n int)) {
var indexSizes = []int{10, 32, 4 << 10, 4 << 20, 64 << 20}
var isRaceBuilder = strings.HasSuffix(testenv.Builder(), "-race")
func BenchmarkIndexByte(b *testing.B) {
benchBytes(b, indexSizes, bmIndexByte(IndexByte))
}
......
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