2 ms·
It looks like they've included slog in their performance benchmarks, which show zap as considerably more performant (though I don't really understand the benchm
by tony_cannistra 3y ago
It looks like they've included slog in their performance benchmarks, which show zap as considerably more performant (though I don't really understand the benchmark).
- llimllib 3y agohttp://bench.zerolog.io/ http://bench.zerolog.io/ Is a useful set of benchmarks
- yencabulator 3y agoThat test puts a lot of stuff through `slog.Any`, while the zap version uses more strongly-typed variants, so I'm not sure it's a fair comparison. What it comes down to is that zap special cases things like slice-of-int, slice-of-string, slice-of-timestamp, slog doesn't, and the benchmark includes all those special cases. I question whether your typical log statement includes slices. A more fair benchmark would be just scalar types, and zap & slog optimizations there look pretty similar. https://github.com/uber-go/zap/blob/fd37f1f613a87773fc30f719cc2aaf9a0e72d635/benchmarks/slog_test.go#L41 https://github.com/uber-go/zap/blob/fd37f1f613a87773fc30f719... https://github.com/uber-go/zap/blob/fd37f1f613a87773fc30f719cc2aaf9a0e72d635/benchmarks/zap_test.go#L127 https://github.com/uber-go/zap/blob/fd37f1f613a87773fc30f719...