Skip to content

Commit b9ecbb9

Browse files
committed
metrics: remove useless benchmarks
1 parent 47b4ccb commit b9ecbb9

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

metrics/sample_test.go

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package metrics
33
import (
44
"math"
55
"math/rand"
6-
"runtime"
76
"testing"
87
"time"
98
)
@@ -27,6 +26,7 @@ func BenchmarkCompute1000(b *testing.B) {
2726
SampleVariance(mean, s)
2827
}
2928
}
29+
3030
func BenchmarkCompute1000000(b *testing.B) {
3131
s := make([]int64, 1000000)
3232
var sum int64
@@ -40,28 +40,6 @@ func BenchmarkCompute1000000(b *testing.B) {
4040
SampleVariance(mean, s)
4141
}
4242
}
43-
func BenchmarkCopy1000(b *testing.B) {
44-
s := make([]int64, 1000)
45-
for i := 0; i < len(s); i++ {
46-
s[i] = int64(i)
47-
}
48-
b.ResetTimer()
49-
for i := 0; i < b.N; i++ {
50-
sCopy := make([]int64, len(s))
51-
copy(sCopy, s)
52-
}
53-
}
54-
func BenchmarkCopy1000000(b *testing.B) {
55-
s := make([]int64, 1000000)
56-
for i := 0; i < len(s); i++ {
57-
s[i] = int64(i)
58-
}
59-
b.ResetTimer()
60-
for i := 0; i < b.N; i++ {
61-
sCopy := make([]int64, len(s))
62-
copy(sCopy, s)
63-
}
64-
}
6543

6644
func BenchmarkExpDecaySample257(b *testing.B) {
6745
benchmarkSample(b, NewExpDecaySample(257, 0.015))
@@ -237,17 +215,9 @@ func TestUniformSampleStatistics(t *testing.T) {
237215
}
238216

239217
func benchmarkSample(b *testing.B, s Sample) {
240-
var memStats runtime.MemStats
241-
runtime.ReadMemStats(&memStats)
242-
pauseTotalNs := memStats.PauseTotalNs
243-
b.ResetTimer()
244218
for i := 0; i < b.N; i++ {
245219
s.Update(1)
246220
}
247-
b.StopTimer()
248-
runtime.GC()
249-
runtime.ReadMemStats(&memStats)
250-
b.Logf("GC cost: %d ns/op", int(memStats.PauseTotalNs-pauseTotalNs)/b.N)
251221
}
252222

253223
func testExpDecaySampleStatistics(t *testing.T, s SampleSnapshot) {

0 commit comments

Comments
 (0)