MCPcopy
hub / github.com/uber-go/zap / BenchmarkZapConsole

Function BenchmarkZapConsole

zapcore/console_encoder_bench_test.go:30–50  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

28)
29
30func BenchmarkZapConsole(b *testing.B) {
31 b.RunParallel(func(pb *testing.PB) {
32 for pb.Next() {
33 enc := NewConsoleEncoder(humanEncoderConfig())
34 enc.AddString("str", "foo")
35 enc.AddInt64("int64-1", 1)
36 enc.AddInt64("int64-2", 2)
37 enc.AddFloat64("float64", 1.0)
38 enc.AddString("string1", "\n")
39 enc.AddString("string2", "💩")
40 enc.AddString("string3", "🤔")
41 enc.AddString("string4", "🙊")
42 enc.AddBool("bool", true)
43 buf, _ := enc.EncodeEntry(Entry{
44 Message: "fake",
45 Level: DebugLevel,
46 }, nil)
47 buf.Free()
48 }
49 })
50}

Callers

nothing calls this directly

Calls 9

NewConsoleEncoderFunction · 0.85
humanEncoderConfigFunction · 0.85
NextMethod · 0.80
AddStringMethod · 0.65
AddInt64Method · 0.65
AddFloat64Method · 0.65
AddBoolMethod · 0.65
EncodeEntryMethod · 0.65
FreeMethod · 0.45

Tested by

no test coverage detected