shithub: hugo

Download patch

ref: 7461ed63ae61aca0f49a36cc8a69ed8594fbcf64
parent: 599e6672f748c19bf6b11481736061be7a03c762
author: Noah Campbell <[email protected]>
date: Tue Aug 20 12:56:18 EDT 2013

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.

--- a/hugolib/benchmark_test.go
+++ b/hugolib/benchmark_test.go
@@ -12,7 +12,8 @@
 	sample.ReadFrom(f)
 	b.ResetTimer()
 	for i := 0; i < b.N; i++ {
-		ReadFrom(sample, "bench")
+		p, _ := ReadFrom(bytes.NewReader(sample.Bytes()), "bench")
+		p = p
 	}
 }