From: Noah Campbell Date: Tue, 20 Aug 2013 23:56:18 +0000 (-0700) Subject: Fix benchmark so the buffer is read each time. X-Git-Tag: v0.9~144 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7461ed63;p=brevno-suite%2Fhugo Fix benchmark so the buffer is read each time. The bytes.Buffer was exhausted after the first read. Creating a new reader each invocation catpures the correctly timing. --- diff --git a/hugolib/benchmark_test.go b/hugolib/benchmark_test.go index 31e58a14..a3408896 100644 --- a/hugolib/benchmark_test.go +++ b/hugolib/benchmark_test.go @@ -12,7 +12,8 @@ func BenchmarkParsePage(b *testing.B) { sample.ReadFrom(f) b.ResetTimer() for i := 0; i < b.N; i++ { - ReadFrom(sample, "bench") + p, _ := ReadFrom(bytes.NewReader(sample.Bytes()), "bench") + p = p } }