Merge pull request #2964 from weaveworks/do-not-reportallocs

do not report allocations in benchmarks
This commit is contained in:
Matthias Radestock
2017-12-08 14:11:18 +00:00
committed by GitHub
6 changed files with 12 additions and 19 deletions

View File

@@ -136,8 +136,9 @@ func BenchmarkLatestMapMerge(b *testing.B) {
// two large maps with some overlap
left := makeBenchmarkMap(0, 1000, time.Now())
right := makeBenchmarkMap(700, 1700, time.Now().Add(1*time.Minute))
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
left.Merge(right)
}
@@ -145,8 +146,9 @@ func BenchmarkLatestMapMerge(b *testing.B) {
func BenchmarkLatestMapEncode(b *testing.B) {
map1 := makeBenchmarkMap(0, 1000, time.Now())
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
buf := &bytes.Buffer{}
codec.NewEncoder(buf, &codec.MsgpackHandle{}).Encode(&map1)
@@ -157,8 +159,9 @@ func BenchmarkLatestMapDecode(b *testing.B) {
map1 := makeBenchmarkMap(0, 1000, time.Now())
buf := &bytes.Buffer{}
codec.NewEncoder(buf, &codec.MsgpackHandle{}).Encode(&map1)
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
var map1 StringLatestMap
codec.NewDecoderBytes(buf.Bytes(), &codec.MsgpackHandle{}).Decode(&map1)

View File

@@ -56,7 +56,7 @@ func BenchmarkMakeNodeSet(b *testing.B) {
"b": "2",
}))
}
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
@@ -161,7 +161,6 @@ func BenchmarkNodeSetAdd(b *testing.B) {
"b": "2",
})
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
@@ -299,7 +298,7 @@ func BenchmarkNodeSetMerge(b *testing.B) {
}),
)
}
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {