Skip to content

Instantly share code, notes, and snippets.

@fd0
Created September 19, 2016 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fd0/908c23123dda275a479cf931f2784f5d to your computer and use it in GitHub Desktop.
Save fd0/908c23123dda275a479cf931f2784f5d to your computer and use it in GitHub Desktop.
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