erigon-pulse/compress/decompress_bench_test.go

54 lines
883 B
Go
Raw Normal View History

package compress
import (
"testing"
)
func BenchmarkDecompressNext(b *testing.B) {
t := new(testing.T)
d := prepareDict(t)
defer d.Close()
g := d.MakeGetter()
for i := 0; i < b.N; i++ {
_, _ = g.Next(nil)
if !g.HasNext() {
g.Reset(0)
}
}
}
func BenchmarkDecompressSkip(b *testing.B) {
t := new(testing.T)
d := prepareDict(t)
defer d.Close()
g := d.MakeGetter()
for i := 0; i < b.N; i++ {
_ = g.Skip()
if !g.HasNext() {
g.Reset(0)
}
}
}
func BenchmarkDecompressMatch(b *testing.B) {
t := new(testing.T)
d := prepareDict(t)
defer d.Close()
g := d.MakeGetter()
for i := 0; i < b.N; i++ {
_, _ = g.Match([]byte("longlongword"))
}
}
func BenchmarkDecompressMatchPrefix(b *testing.B) {
t := new(testing.T)
d := prepareDict(t)
defer d.Close()
g := d.MakeGetter()
for i := 0; i < b.N; i++ {
_ = g.MatchPrefix([]byte("longlongword"))
}
}