> Oh, and if we are talking about performance, I would appreciate everyone
> being very careful about placing debug statements inside any code that is
> executed for every message through the system.  Several of these have been
> introduced with the advent of the message caching and David J's new stuff.
> 
> The cost of constructing all the message strings, even if they aren't used,
> can add considerable overhead to the system (if you don't believe me then
> create a test and see).  Remember I managed to get somewhere between a 10 to
> 20 times speed improvement by improving the serialisation code and removing
> these debug statements from inside the inner loop.  If you really, really
> want them then place them behind a static final boolean flag i.e.
> 
> if(DEBUG) log.debug("a message");

Please don't do this.  Use something more like this:

if (log.isDebugEnabled()) {
   log.debug("some msg");
   log.debug("some other msg");
}

If you are really trying to trim down execution costs and you have lots of 
spread out debugs in a method, then something like this:

boolean debug = log.isDebugEnabled();
// ...
if (debug) {
   log.debug("foo");
}
// ...
if (debug) {
   log.debug("bar");
}

The cost of this is minor and allows for dynamic contol over the processing 
of these log messages.

--jason


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to