Add benchmark for context appending
This commit is contained in:
parent
e26050b2a3
commit
d76a89fffc
|
@ -57,6 +57,18 @@ func BenchmarkContextFields(b *testing.B) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkContextAppend(b *testing.B) {
|
||||||
|
logger := New(ioutil.Discard).With().
|
||||||
|
Str("foo", "bar").
|
||||||
|
Logger()
|
||||||
|
b.ResetTimer()
|
||||||
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
|
for pb.Next() {
|
||||||
|
logger.With().Str("bar", "baz")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkLogFields(b *testing.B) {
|
func BenchmarkLogFields(b *testing.B) {
|
||||||
logger := New(ioutil.Discard)
|
logger := New(ioutil.Discard)
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
Loading…
Reference in New Issue