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

Function Benchmark

diode/diode_test.go:150–171  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

148}
149
150func Benchmark(b *testing.B) {
151 log.SetOutput(io.Discard)
152 defer log.SetOutput(os.Stderr)
153 benchs := map[string]time.Duration{
154 "Waiter": 0,
155 "Pooler": 10 * time.Millisecond,
156 }
157 for name, interval := range benchs {
158 b.Run(name, func(b *testing.B) {
159 w := diode.NewWriter(io.Discard, 100000, interval, nil)
160 log := zerolog.New(w)
161 defer w.Close()
162
163 b.SetParallelism(1000)
164 b.RunParallel(func(pb *testing.PB) {
165 for pb.Next() {
166 log.Print("test")
167 }
168 })
169 })
170 }
171}

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
NewWriterFunction · 0.92
NewFunction · 0.92
PrintMethod · 0.80
RunMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected