commit 7461ed63ae61aca0f49a36cc8a69ed8594fbcf64
parent 599e6672f748c19bf6b11481736061be7a03c762
Author: Noah Campbell <noahcampbell@gmail.com>
Date: Tue, 20 Aug 2013 16:56:18 -0700
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.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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
}
}