frame: Add benchmark for FLAC decoding.

This commit is contained in:
mewmew 2016-02-11 18:51:22 +01:00
parent 5c6ad5e1d5
commit 5e5fb51cd7

View file

@ -56,3 +56,24 @@ func TestFrameHash(t *testing.T) {
}
}
}
func BenchmarkFrameParse(b *testing.B) {
// The file 151185.flac is a 119.5 MB public domain FLAC file used to
// benchmark the flac library. Because of its size, it has not been included
// in the repository, but is available for download at
//
// http://freesound.org/people/jarfil/sounds/151185/
stream, err := flac.Open("../testdata/benchmark/151185.flac")
if err != nil {
b.Fatal(err)
}
for i := 0; i < b.N; i++ {
_, err := stream.ParseNext()
if err != nil {
if err == io.EOF {
break
}
b.Fatal(err)
}
}
}