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

Function BenchmarkLogFieldType

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

Source from the content-addressed store, hash-verified

101}
102
103func BenchmarkLogFieldType(b *testing.B) {
104 fixtures := makeFieldFixtures()
105 types := map[string]func(e *Event) *Event{
106 "Any": func(e *Event) *Event {
107 return e.Any("k", fixtures.Interfaces[0])
108 },
109 "Bool": func(e *Event) *Event {
110 return e.Bool("k", fixtures.Bools[0])
111 },
112 "Bools": func(e *Event) *Event {
113 return e.Bools("k", fixtures.Bools)
114 },
115 "Bytes": func(e *Event) *Event {
116 return e.Bytes("k", fixtures.Bytes)
117 },
118 "Hex": func(e *Event) *Event {
119 return e.Hex("k", fixtures.Bytes)
120 },
121 "Int": func(e *Event) *Event {
122 return e.Int("k", fixtures.Ints[0])
123 },
124 "Ints": func(e *Event) *Event {
125 return e.Ints("k", fixtures.Ints)
126 },
127 "Float32": func(e *Event) *Event {
128 return e.Float32("k", fixtures.Floats32[0])
129 },
130 "Floats32": func(e *Event) *Event {
131 return e.Floats32("k", fixtures.Floats32)
132 },
133 "Float64": func(e *Event) *Event {
134 return e.Float64("k", fixtures.Floats64[0])
135 },
136 "Floats64": func(e *Event) *Event {
137 return e.Floats64("k", fixtures.Floats64)
138 },
139 "Str": func(e *Event) *Event {
140 return e.Str("k", fixtures.Strings[0])
141 },
142 "Strs": func(e *Event) *Event {
143 return e.Strs("k", fixtures.Strings)
144 },
145 "StrsV": func(e *Event) *Event {
146 return e.StrsV("k", fixtures.Strings...)
147 },
148 "Stringer": func(e *Event) *Event {
149 return e.Stringer("k", fixtures.Stringers[0])
150 },
151 "Stringers": func(e *Event) *Event {
152 return e.Stringers("k", fixtures.Stringers)
153 },
154 "StringersV": func(e *Event) *Event {
155 return e.StringersV("k", fixtures.Stringers...)
156 },
157 "Err": func(e *Event) *Event {
158 return e.Err(fixtures.Errs[0])
159 },
160 "Errs": func(e *Event) *Event {

Callers

nothing calls this directly

Calls 15

makeFieldFixturesFunction · 0.85
NewFunction · 0.85
MsgMethod · 0.80
ErrMethod · 0.65
RunMethod · 0.65
NextMethod · 0.65
InfoMethod · 0.65
AnyMethod · 0.45
BoolMethod · 0.45
BoolsMethod · 0.45
BytesMethod · 0.45
HexMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…