I'm seeing sub-par performance with the program below, and thought maybe some of the bright folks on this list could help...
The issue I'm having is that the new logging format log.trace("some string %s", string) is much slower than the old one if(log.isTraceEnabled()) log.trace("some string " + string).
This is the case both with TRACE logging enabled and disabled !
The logger here is basically a pass-through to log4j2.
The test can be started with
java org.jgroups.tests.bla5 10000 true // use the new format
java org.jgroups.tests.bla5 10000 false / use the old format
- OLD :5.0 M statements/sec
- NEW: 2.7 M statements/sec
- If I uncomment the log.isTraceEnabled() in NEW, I get the same perf (5 M) as with OLD, makes sense
- If I remove the varargs, I get the same perf, too
- Q: is it the creation of the vararg array and the copying of the args into it which takes so much time ?
- OLD: 11'000 statements / sec
- NEW: 7'200 statements / sec
- If I don't pass the varargs, e.g. log.trace("static string"), the perf in NEW is 12'000 !
- Q: is the parsing of the format string taking that much time, such that it is slower than the conversion of i into a string and the string concatenation/copying in the OLD version ?
Some discussion on the core dwelt on the merits of using OLD versus NEW, and my take-away was that NEW was as fast as OLD. Is this not te case ?