@@ -48,9 +48,9 @@ func newRandMetric(tb testing.TB, rand *rand.Rand, i int) *Metric {
48
48
}
49
49
50
50
type bench struct {
51
- name string
52
- setup func (b * testing.B , rand * rand.Rand , items int , m * []* Metric , s * Store )
53
- b func (b * testing.B , items int , m []* Metric , s * Store )
51
+ name string
52
+ setup func (b * testing.B , rand * rand.Rand , items int , m * []* Metric , s * Store )
53
+ benchFunc func (b * testing.B , items int , m []* Metric , s * Store )
54
54
}
55
55
56
56
func fillMetric (b * testing.B , rand * rand.Rand , items int , m * []* Metric , _ * Store ) {
@@ -70,9 +70,9 @@ func addToStore(b *testing.B, items int, m []*Metric, s *Store) {
70
70
func BenchmarkStore (b * testing.B ) {
71
71
benches := []bench {
72
72
{
73
- name : "Add" ,
74
- setup : fillMetric ,
75
- b : addToStore ,
73
+ name : "Add" ,
74
+ setup : fillMetric ,
75
+ benchFunc : addToStore ,
76
76
},
77
77
{
78
78
name : "Iterate" ,
@@ -81,7 +81,7 @@ func BenchmarkStore(b *testing.B) {
81
81
fillMetric (b , rand , items , m , s )
82
82
addToStore (b , items , * m , s )
83
83
},
84
- b : func (b * testing.B , _ int , _ []* Metric , s * Store ) {
84
+ benchFunc : func (b * testing.B , _ int , _ []* Metric , s * Store ) {
85
85
b .Helper ()
86
86
s .Range (func (* Metric ) error {
87
87
return nil
@@ -117,12 +117,12 @@ func BenchmarkStore(b *testing.B) {
117
117
if parallel {
118
118
b .RunParallel (func (pb * testing.PB ) {
119
119
for pb .Next () {
120
- bench .b (b , items , m , s )
120
+ bench .benchFunc (b , items , m , s )
121
121
}
122
122
})
123
123
} else {
124
124
for n := 0 ; n < b .N ; n ++ {
125
- bench .b (b , items , m , s )
125
+ bench .benchFunc (b , items , m , s )
126
126
if gc {
127
127
s .Gc ()
128
128
}
0 commit comments