Skip to content

Commit 5cddc9a

Browse files
committed
add benchmark for record.SetBody
1 parent 565eba4 commit 5cddc9a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

sdk/log/record_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,3 +1023,23 @@ func BenchmarkSetAddAttributes(b *testing.B) {
10231023
}
10241024
})
10251025
}
1026+
1027+
func BenchmarkSetBody(b *testing.B) {
1028+
b.Run("SetBody", func(b *testing.B) {
1029+
records := make([]Record, b.N)
1030+
1031+
b.ResetTimer()
1032+
b.ReportAllocs()
1033+
for i := 0; i < b.N; i++ {
1034+
records[i].SetBody(log.MapValue(
1035+
log.Bool("0", true),
1036+
log.Float64("2", 3.0),
1037+
log.String("3", "forth"),
1038+
log.Slice("4", log.Int64Value(1)),
1039+
log.Map("5", log.Int("key", 2)),
1040+
log.Bytes("6", []byte("six")),
1041+
log.Int64("1", 3),
1042+
))
1043+
}
1044+
})
1045+
}

0 commit comments

Comments
 (0)