Skip to content

Instantly share code, notes, and snippets.

@fd0
Created Sep 19, 2016
Embed
What would you like to do?
package main
import (
"crypto/rand"
"io"
"testing"
)
func BenchmarkCompressibility(b *testing.B) {
buf := make([]byte, 8*1024*1024)
_, err := io.ReadFull(rand.Reader, buf)
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
b.SetBytes(int64(len(buf)))
for i := 0; i < b.N; i++ {
compressibility(buf)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment