aboutsummaryrefslogtreecommitdiff
path: root/internal/adler32/bench_test.go
blob: fa5a3f9e573b40d768b54c4c52182ea8d1ec32ed (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package adler32_test

import (
	"testing"

	"lindenii.org/go/furgit/internal/adler32"
)

const benchmarkSize = 64 * 1024

//nolint:gochecknoglobals
var data = make([]byte, benchmarkSize)

func init() { //nolint:gochecknoinits
	for i := range benchmarkSize {
		data[i] = byte(i % 256)
	}
}

func BenchmarkChecksum(b *testing.B) {
	b.ReportAllocs()

	for b.Loop() {
		adler32.Checksum(data)
	}
}