mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
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.
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user