aboutsummaryrefslogtreecommitdiff
path: root/internal/adler32/bench_test.go
blob: d2aebe8f238ebfaab5634ede310dce5033413355 (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
package adler32_test

import (
	"testing"

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

const benchmarkSize = 64 * 1024

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)
	}
}