Moved from:
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3920735#3920735
I have just retested without a profiler.
Ok, it's not 15%, it's about 4.5%
with if (trace): (msgs/sec)
5150
5224
5289
5229
5246
5289
5182
5224
mean: 5229
with if (log.isTraceEnabled())
4812
5059
5018
4980
5100
5039
5018
5000
mean: 5003
% difference = 4.5%
So smaller than i thought (maybe the profiler was making a difference) but significant nevertheless.
BTW we are not calling log.isTraceEnabled() in any inner loops.
Hmm. I'm doing the if(trace), if(warn) etc etc extensively, to get better perf in JGroups. Downside: you cannot change this at runtime, e.g. in JBoss, by modifying log4j.xml...