Hello, I am working on the next release of log4j2-logstash-layout <https://github.com/vy/log4j2-logstash-layout/tree/json-generator>, which is an alternative to the default JsonLayout and allows custom JSON schemas. There I achieved to get up to 5x speed up compared to JsonLayout[1] and I want to stretch this further by reducing the GC load. Though it is really difficult given Layout interface (practically) requires an output of type String. I examined the internals of other gc-free layouts, e.g., Pattern, Gelf, etc. Though each ends up making a call to StringBuilder#toString(), which is not gc-free, to the best of my knowledge. Would anyone mind shedding some light onto the issue, please?
Best. [1] Please feel free to check JMH benchmarks <https://github.com/vy/log4j2-logstash-layout/blob/json-generator/layout/src/test/perf/com/vlkan/log4j2/logstash/layout/LogstashLayoutBenchmarkState.java> and their results <https://github.com/vy/log4j2-logstash-layout/blob/json-generator/BENCHMARK.txt>. Maybe there I am misconfiguring JsonLayout to cause it under-perform.
