mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 05:32:14 -05: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:
parent
599e6672f7
commit
7461ed63ae
1 changed files with 2 additions and 1 deletions
|
@ -12,7 +12,8 @@ func BenchmarkParsePage(b *testing.B) {
|
||||||
sample.ReadFrom(f)
|
sample.ReadFrom(f)
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
ReadFrom(sample, "bench")
|
p, _ := ReadFrom(bytes.NewReader(sample.Bytes()), "bench")
|
||||||
|
p = p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue