@@ -36,7 +36,6 @@ func makeQuery2(leaf1 interface{}, leaf2 interface{}) *Node {
36
36
}
37
37
38
38
func BenchmarkRenderOne (b * testing.B ) {
39
-
40
39
const kName = "api_key"
41
40
tmpl := NewTmpl ()
42
41
token := tmpl .Bind (kName )
@@ -47,6 +46,7 @@ func BenchmarkRenderOne(b *testing.B) {
47
46
b .Fatal (err )
48
47
}
49
48
49
+ b .ResetTimer ()
50
50
// run the RenderOne function b.N times
51
51
for n := 0 ; n < b .N ; n ++ {
52
52
if _ , err := tmpl .RenderOne (kName , "2Ye0F3UByTc0c1e9OeMO" ); err != nil {
@@ -56,7 +56,6 @@ func BenchmarkRenderOne(b *testing.B) {
56
56
}
57
57
58
58
func BenchmarkRender (b * testing.B ) {
59
-
60
59
const kName = "api_key"
61
60
tmpl := NewTmpl ()
62
61
token := tmpl .Bind (kName )
@@ -69,6 +68,7 @@ func BenchmarkRender(b *testing.B) {
69
68
70
69
v := "2Ye0F3UByTc0c1e9OeMO"
71
70
71
+ b .ResetTimer ()
72
72
// run the RenderOne function b.N times
73
73
for n := 0 ; n < b .N ; n ++ {
74
74
if _ , err := tmpl .Render (map [string ]interface {}{
@@ -80,7 +80,6 @@ func BenchmarkRender(b *testing.B) {
80
80
}
81
81
82
82
func BenchmarkMarshalNode (b * testing.B ) {
83
-
84
83
// run the RenderOne function b.N times
85
84
for n := 0 ; n < b .N ; n ++ {
86
85
query := makeQuery ("2Ye0F3UByTc0c1e9OeMO" )
@@ -89,7 +88,6 @@ func BenchmarkMarshalNode(b *testing.B) {
89
88
}
90
89
91
90
func BenchmarkMarshalNode2 (b * testing.B ) {
92
-
93
91
// run the RenderOne function b.N times
94
92
for n := 0 ; n < b .N ; n ++ {
95
93
query := makeQuery2 ("27e58fc0-09a2-11eb-a8cd-57e98f140de5" , 3 )
@@ -106,14 +104,14 @@ func BenchmarkSprintf(b *testing.B) {
106
104
policyRev := 3
107
105
108
106
var s string
107
+ b .ResetTimer ()
109
108
for n := 0 ; n < b .N ; n ++ {
110
109
s = fmt .Sprintf (queryTmpl , policyID , policyRev )
111
110
}
112
111
ssprintres = s
113
112
}
114
113
115
114
func BenchmarkRender2 (b * testing.B ) {
116
-
117
115
const kName1 = "policyId"
118
116
const kName2 = "policyRev"
119
117
@@ -128,6 +126,7 @@ func BenchmarkRender2(b *testing.B) {
128
126
}
129
127
130
128
// run the RenderOne function b.N times
129
+ b .ResetTimer ()
131
130
for n := 0 ; n < b .N ; n ++ {
132
131
m := map [string ]interface {}{
133
132
kName1 : "27e58fc0-09a2-11eb-a8cd-57e98f140de5" ,
0 commit comments