github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/internal/bytealg/bytealg_test.go (about)

     1  package bytealg_test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  var benchmarkBufferSizes = [...]int{
     9  	4 * 1024,
    10  	256 * 1024,
    11  	2048 * 1024,
    12  }
    13  
    14  func forEachBenchmarkBufferSize(b *testing.B, f func(*testing.B, int)) {
    15  	for _, bufferSize := range benchmarkBufferSizes {
    16  		b.Run(fmt.Sprintf("%dKiB", bufferSize/1024), func(b *testing.B) {
    17  			b.SetBytes(int64(bufferSize))
    18  			f(b, bufferSize)
    19  		})
    20  	}
    21  }