File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 88
99var (
1010 // dsn from driver_test.go
11- sample = []byte (strings .Repeat ("0123456789abcdef" , 1024 * 1024 ))
11+ sample = []byte (strings .Repeat ("0123456789abcdef" , 1024 * 1024 ))
12+ min , max = 16 , len (sample )
1213)
1314
1415func BenchmarkRoundtripText (b * testing.B ) {
@@ -19,7 +20,10 @@ func BenchmarkRoundtripText(b *testing.B) {
1920 defer db .Close ()
2021 var result string
2122 for i := 0 ; i < b .N ; i ++ {
22- length := 16 + i % (4 * b .N )
23+ length := min + i
24+ if length > max {
25+ length = max
26+ }
2327 test := string (sample [0 :length ])
2428 rows , err := db .Query ("SELECT \" " + test + "\" " )
2529 if err != nil {
@@ -54,7 +58,10 @@ func BenchmarkRoundtripPrepared(b *testing.B) {
5458 b .Fatalf ("crashed" )
5559 }
5660 for i := 0 ; i < b .N ; i ++ {
57- length := 16 + i % (4 * b .N )
61+ length := min + i
62+ if length > max {
63+ length = max
64+ }
5865 test := string (sample [0 :length ])
5966 rows , err := stmt .Query (test )
6067 if err != nil {
You can’t perform that action at this time.
0 commit comments