1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
package adler32 import ( "testing" ) const benchmarkSize = 64 * 1024 var data = make([]byte, benchmarkSize) func init() { for i := range benchmarkSize { data[i] = byte(i % 256) } } func BenchmarkChecksum(b *testing.B) { b.ReportAllocs() for range b.N { Checksum(data) } }