@@ -63,6 +63,83 @@ func BenchmarkCopy1000000(b *testing.B) {
63
63
}
64
64
}
65
65
66
+ func BenchmarkSampleCalc4KSampleSum (b * testing.B ) {
67
+ s := make ([]int64 , 4096 )
68
+ for i := 0 ; i < len (s ); i ++ {
69
+ s [i ] = int64 (i )
70
+ }
71
+ b .ResetTimer ()
72
+ for i := 0 ; i < b .N ; i ++ {
73
+ SampleSum (s )
74
+ }
75
+ }
76
+
77
+ func BenchmarkSampleCalc4KSampleMax (b * testing.B ) {
78
+ s := make ([]int64 , 4096 )
79
+ for i := 0 ; i < len (s ); i ++ {
80
+ s [i ] = int64 (i )
81
+ }
82
+ b .ResetTimer ()
83
+ for i := 0 ; i < b .N ; i ++ {
84
+ SampleMax (s )
85
+ }
86
+ }
87
+
88
+ func BenchmarkSampleCalc4KSampleMin (b * testing.B ) {
89
+ s := make ([]int64 , 4096 )
90
+ for i := 0 ; i < len (s ); i ++ {
91
+ s [i ] = int64 (i )
92
+ }
93
+ b .ResetTimer ()
94
+ for i := 0 ; i < b .N ; i ++ {
95
+ SampleMin (s )
96
+ }
97
+ }
98
+
99
+ func BenchmarkSampleCalc4KSampleMean (b * testing.B ) {
100
+ s := make ([]int64 , 4096 )
101
+ for i := 0 ; i < len (s ); i ++ {
102
+ s [i ] = int64 (i )
103
+ }
104
+ b .ResetTimer ()
105
+ for i := 0 ; i < b .N ; i ++ {
106
+ SampleMean (s )
107
+ }
108
+ }
109
+
110
+ func BenchmarkSampleCalc4KSampleStdDev (b * testing.B ) {
111
+ s := make ([]int64 , 4096 )
112
+ for i := 0 ; i < len (s ); i ++ {
113
+ s [i ] = int64 (i )
114
+ }
115
+ b .ResetTimer ()
116
+ for i := 0 ; i < b .N ; i ++ {
117
+ SampleStdDev (s )
118
+ }
119
+ }
120
+
121
+ func BenchmarkSampleCalc4KSampleVariance (b * testing.B ) {
122
+ s := make ([]int64 , 4096 )
123
+ for i := 0 ; i < len (s ); i ++ {
124
+ s [i ] = int64 (i )
125
+ }
126
+ b .ResetTimer ()
127
+ for i := 0 ; i < b .N ; i ++ {
128
+ SampleVariance (s )
129
+ }
130
+ }
131
+
132
+ func BenchmarkSampleCalc4KSamplePercentile (b * testing.B ) {
133
+ s := make ([]int64 , 4096 )
134
+ for i := 0 ; i < len (s ); i ++ {
135
+ s [i ] = int64 (i )
136
+ }
137
+ b .ResetTimer ()
138
+ for i := 0 ; i < b .N ; i ++ {
139
+ SamplePercentile (s , 0.5 )
140
+ }
141
+ }
142
+
66
143
func BenchmarkExpDecaySample257 (b * testing.B ) {
67
144
benchmarkSample (b , NewExpDecaySample (257 , 0.015 ))
68
145
}
0 commit comments