Hi Ralph, On Fri, 24 May 2024 at 22:50, Ralph Goers <ralph.go...@dslextreme.com> wrote: > Thanks! Is there any chance you could provide some sample code we could use > to perform performance testing? Based on your description I have a suspicion > that ScopedContext would perform even better but at this point that is just > speculation without tests. Of course, that may be minimal and might not be > worth the effort of having to change code.
I am sure `ScopedContext` can be as fast as `ThreadContext`. I pushed a JMH benchmark we could improve to get some measurements[1]. It's a work in progress, I am not sharing the first results, because the two differ by almost two orders of magnitude. I suspect some aggressive JVM optimization is taking place. Piotr [1] https://github.com/apache/logging-log4j2/blob/2.x/log4j-perf-test/src/main/java/org/apache/logging/log4j/perf/jmh/ThreadContextVsScopedContextBenchmark.java