JSON Encoding Performance
osiegmar opened this issue · 1 comments
Discussed in #83
Originally posted by pschichtel June 22, 2022
As part of the performance work I've been doing on the project I work on, I ended up completely rewriting the GelfEncoder to avoid allocations and remove overhead.
https://gist.github.com/pschichtel/cb5556b9d5b681e1e77afabb749186e9
I implemented it using Jackson and Kotlin, since we are using those anyway, so I don't expect any of this to be merged.
This implementation is significantly faster and generates a lot fewer objects then the original one.
However while implementing this I noticed two "issues":
- the gelf version constant is not accessible
- the GelfUdpAppender (I assume the same to be the case for the others) expect a subclass of GelfEncoder
The former could easily be solved by making it a public constant, not so sure about the latter, but it is also not really a problem.
I made some changes locally but in the end I decided to keep the code as it is (for maintainability reasons).