mirror of https://github.com/perkeep/perkeep.git
rollsum: log stats after benchmark run
Change-Id: I2c8983d13ea80efb383ebf77316e6ad0a5da9f57
This commit is contained in:
parent
137528b7d6
commit
82329b5882
|
@ -57,15 +57,17 @@ func TestSum(t *testing.T) {
|
|||
func BenchmarkRollsum(b *testing.B) {
|
||||
bytesSize := int64(1024 * 1024 * 5)
|
||||
rs := New()
|
||||
bits := 0
|
||||
splits := 0
|
||||
for i := 0; i < b.N; i++ {
|
||||
splits = 0
|
||||
for j := int64(0); j < bytesSize; j++ {
|
||||
rs.Roll(byte(rand.Int63() & 0xff))
|
||||
if rs.OnSplit() {
|
||||
bits = rs.Bits()
|
||||
_ = rs.Bits()
|
||||
splits++
|
||||
}
|
||||
}
|
||||
}
|
||||
b.SetBytes(bytesSize)
|
||||
_ = bits
|
||||
b.Logf("num splits = %d; every %d bytes", splits, int(float64(bytesSize) / float64(splits)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue