On Wed, 14 Nov 2001, Jason Dillon wrote:

> > 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:
>

class foo
  public static final boolean DEBUG = false;
...

  public void myFoo() {
    boolean debug = false;
    if (DEBUG) debug = log.isDebugEnabled();
...
    if (DEBUG && debug) {
      log.debug("foo");
    }
...

Sometimes, I wish java had a preprocessor.


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

Reply via email to