Skip to content

Commit 047fd14

Browse files
committed
codec: bench: add io with bufsize=0 to quicksuite, and other nits (use fmt.Sprintf not strconv.Itoa)
1 parent 707f480 commit 047fd14

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

codec/z_all_bench_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package codec
88
// see notes in z_all_test.go
99

1010
import (
11-
"strconv"
11+
"fmt"
1212
"testing"
1313
"time"
1414
)
@@ -56,17 +56,20 @@ func benchmarkSuite(t *testing.B, fns ...func(t *testing.B)) {
5656
tbvars.setBufsize(1024)
5757
testReinit()
5858
t.Run("use-io-1024-....", f)
59+
60+
tbvars.setBufsize(0)
61+
testReinit()
62+
t.Run("use-io-0-.......", f)
5963
}
6064

6165
func benchmarkVeryQuickSuite(t *testing.B, name string, fns ...func(t *testing.B)) {
6266
defer tbvars.setBufsize((int)(testv.bufsize))
6367
benchmarkDivider()
6468

6569
tbvars.setBufsize(-1)
66-
// testv.Depth = depth
6770
testReinit()
6871

69-
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"........", benchmarkOneFn(fns))
72+
t.Run(fmt.Sprintf("%s-bd%d........", name, testv.Depth), benchmarkOneFn(fns))
7073
}
7174

7275
func benchmarkQuickSuite(t *testing.B, name string, fns ...func(t *testing.B)) {
@@ -75,14 +78,12 @@ func benchmarkQuickSuite(t *testing.B, name string, fns ...func(t *testing.B)) {
7578

7679
// encoded size of TestStruc is between 20K and 30K for bd=1 // consider buffer=1024 * 16 * testv.Depth
7780
tbvars.setBufsize(1024) // (value of byteBufSize): use smaller buffer, and more flushes - it's ok.
78-
// testv.Depth = depth
7981
testReinit()
80-
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"-buf"+strconv.Itoa((int)(testv.bufsize)), benchmarkOneFn(fns))
82+
t.Run(fmt.Sprintf("%s-bd%d-buf%d", name, testv.Depth, 1024), benchmarkOneFn(fns))
8183

8284
tbvars.setBufsize(0)
83-
// testv.Depth = depth
8485
testReinit()
85-
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"-io.....", benchmarkOneFn(fns))
86+
t.Run(fmt.Sprintf("%s-bd%d-io.....", name, testv.Depth), benchmarkOneFn(fns))
8687
}
8788

8889
/*

0 commit comments

Comments
 (0)