From

http://jakarta.apache.org/log4j/docs/manual.html

(Under the Perfomance Heading, point 2)

QUOTE
There has been a serious effort to make this hierarchy walk to be as fast as possible. 
END QUOTE

You can apparently speed the walk up further, by choosing the
categories carefully, you should probably consider this even if
you decide to cache the result.

In my local (older) copy of this manual

 The typical cost of walking this hierarchy is in the range 5 to 15
 microseconds on a Pentium II @ 233 Mhz'

Although this has disappeared from the online version.


regards

Neale Swinnerton

On Wed, Aug 15, 2001 at 01:55:17PM +0200, Vincent Harcq wrote:
> Hi,
> 
> > Does anyone know what the cost of the isXXXEnabled() methods are? 
> >  Should we
> > define booleans after Category creation, that can cache these values to
> > improve speed, or just keep calling isXXXEnabled() each time?
> 
> >From the log4j sources:
>   public
>   boolean isDebugEnabled() {
>     if(hierarchy.disable >=  Priority.DEBUG_INT)
>       return false;   
>     return Priority.DEBUG.isGreaterOrEqual(this.getChainedPriority());
>   }
> 
> The getChainedPriority is a recursive method:
>     for(Category c = this; c != null; c=c.parent)
>     {
>        if(c.priority != null) 
>        return c.priority;
>     }
> 
> Save the result in a boolean and test the boolean will improve performance.
> I am not at all a performance guru, I have no idea at which level it will.
> 
> It is a good idea to do what you propose.
> 
> > --jason
> 
> Vincent.
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-development
> 
> 

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

Reply via email to