ref: 7730d683e8b030c64c5f986b8166c8e65b777ab3
parent: bb048d811d3977adb10656335cd339cd8c945a25
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Nov 15 20:13:07 EST 2017
tplimpl: Make partial benchmarks use RunParallel See #4086
--- a/tpl/tplimpl/template_funcs_test.go
+++ b/tpl/tplimpl/template_funcs_test.go
@@ -194,11 +194,13 @@
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 {