lujiajing1126 opened a new pull request #12:
URL: https://github.com/apache/skywalking-banyandb/pull/12
The `rs/zerolog` is much faster (at least ~2x) than `uber/zap` as I have
done the benchmark.
The benchmarks (run for 10 seconds) focus on a three-field(`String`, `Int`,
`Float32`) logging for both `zerolog` and `zap` with either JSON encoder and
CONSOLE encoder.
For zap,
```
goos: darwin
goarch: amd64
pkg: ...
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
BenchmarkVanillaZapTextPositive-8 40449751 341.4 ns/op
64 B/op 3 allocs/op
BenchmarkVanillaZapTextNegative-8 1000000000 2.782 ns/op
0 B/op 0 allocs/op
BenchmarkVanillaZapJSONNegative-8 247553424 52.61 ns/op
192 B/op 1 allocs/op
BenchmarkVanillaZapJSONPositive-8 22189645 547.3 ns/op
192 B/op 1 allocs/op
PASS
```
For zerolog,
```
goos: darwin
goarch: amd64
pkg: ...
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
BenchmarkVanillaZerologTextPositive-8 76793395 158.5
ns/op 0 B/op 0 allocs/op
BenchmarkVanillaZerologTextNegative-8 1000000000 1.199
ns/op 0 B/op 0 allocs/op
BenchmarkVanillaZerologJSONNegative-8 1000000000 3.178
ns/op 0 B/op 0 allocs/op
BenchmarkVanillaZerologJSONPositive-8 59657577 215.7
ns/op 0 B/op 0 allocs/op
PASS
```
It is obvious that in JSON encoder + Negative scenarios, due to the better
designed API, zerolog is much faster with real zero allocation.
It would be useful if we want to put more debug logs in the program without
any performance issue in the production.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]