From 7461ed63ae61aca0f49a36cc8a69ed8594fbcf64 Mon Sep 17 00:00:00 2001 From: Noah Campbell Date: Tue, 20 Aug 2013 16:56:18 -0700 Subject: [PATCH] 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. --- hugolib/benchmark_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hugolib/benchmark_test.go b/hugolib/benchmark_test.go index 31e58a14a..a3408896d 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 } }