MCPcopy
hub / github.com/rs/zerolog / BenchmarkLogArrayObject

Function BenchmarkLogArrayObject

benchmark_test.go:87–101  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

85}
86
87func BenchmarkLogArrayObject(b *testing.B) {
88 obj1 := fixtureObj{"a", "b", 2}
89 obj2 := fixtureObj{"c", "d", 3}
90 obj3 := fixtureObj{"e", "f", 4}
91 logger := New(io.Discard)
92 b.ResetTimer()
93 b.ReportAllocs()
94 for i := 0; i < b.N; i++ {
95 arr := Arr()
96 arr.Object(&obj1)
97 arr.Object(&obj2)
98 arr.Object(&obj3)
99 logger.Info().Array("objects", arr).Msg("test")
100 }
101}
102
103func BenchmarkLogFieldType(b *testing.B) {
104 fixtures := makeFieldFixtures()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
ArrFunction · 0.85
MsgMethod · 0.80
InfoMethod · 0.65
ObjectMethod · 0.45
ArrayMethod · 0.45

Tested by

no test coverage detected