I just updated onelog, my zero alloc JSON logger, and made it the fastest JSON logger out there by far, thanks to a simple `pooling optimisation` in gojay (the underlying JSON encoder).
Previously, I was using buffered channel in Gojay to pool encoders in memory. My logger was fast already, but zerolog or zap was a bit faster in some cases. I noticed through profiling, that sometime, it took time to acquire from channels and increasing the buffer size didnt chang.
Then I disabled pooling and noticed a good performance increase but more allocations. so I tried with sync.Pool, made a safe usage of it and performance of the logger have jumped 2x to 3x.
It is now by far the fastest JSON logger out there.
I just updated onelog, my zero alloc JSON logger, and made it the fastest JSON logger out there by far, thanks to a simple `pooling optimisation` in gojay (the underlying JSON encoder).
Previously, I was using buffered channel in Gojay to pool encoders in memory. My logger was fast already, but zerolog or zap was a bit faster in some cases. I noticed through profiling, that sometime, it took time to acquire from channels and increasing the buffer size didnt chang.
Then I disabled pooling and noticed a good performance increase but more allocations. so I tried with sync.Pool, made a safe usage of it and performance of the logger have jumped 2x to 3x.
It is now by far the fastest JSON logger out there.