tplimpl: Make partial benchmarks use RunParallel - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 7730d683e8b030c64c5f986b8166c8e65b777ab3
DIR parent bb048d811d3977adb10656335cd339cd8c945a25
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Thu, 16 Nov 2017 01:13:07 +0100
tplimpl: Make partial benchmarks use RunParallel
See #4086
Diffstat:
M tpl/tplimpl/template_funcs_test.go | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
DIR diff --git a/tpl/tplimpl/template_funcs_test.go b/tpl/tplimpl/template_funcs_test.go
@@ -194,11 +194,13 @@ func doBenchmarkPartial(b *testing.B, f func(ns *partials.Namespace) error) {
ns := partials.New(de)
b.ResetTimer()
- for i := 0; i < b.N; i++ {
- if err := f(ns); err != nil {
- b.Fatalf("error executing template: %s", err)
+ b.RunParallel(func(pb *testing.PB) {
+ for pb.Next() {
+ if err := f(ns); err != nil {
+ b.Fatalf("error executing template: %s", err)
+ }
}
- }
+ })
}
func newTestFuncster() *templateFuncster {