You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
443 B

package testutil
import (
"fmt"
"testing"
)
// Payloads returns a payload sizes list.
// Helpful for benchmarks.
func Payloads() []int {
return []int{
16,
128,
1024,
8192,
64 * 1024,
512 * 1024,
}
}
// RunPayloads runs given benchmark runner for every payload.
func RunPayloads(b *testing.B, runner func(size int) func(b *testing.B)) {
for _, size := range Payloads() {
b.Run(fmt.Sprintf("%db", size), runner(size))
}
}