mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-20 17:31:11 +00:00
54 lines
883 B
Go
54 lines
883 B
Go
|
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"))
|
||
|
}
|
||
|
}
|