avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: Loggers, final classes and performance
Date Fri, 30 Nov 2001 14:54:22 GMT
On Fri, 30 Nov 2001 20:15, Vincent Massol wrote:
> This is used in a generic method that is called to automatically log
> entries and exits of methods, so it is executed every time there is a log
> to be made for an entry/exit. It is thus called very often.

ouch. Question - why don't you cache it ?

> I'd like to know if it has any performance issue. More specifically, I'd
> like to know if the final keyword helps for performance (as it does for
> final methods which are inlined) 

a little bit.

> I guess that even with the final
> keyword, there is always a new object instanciated in memory ...

yep. However depending on what JVM you are using it will come almost for 
free. In JDK1.4 there would be virtually no cost (because it is a small 
shortlived lightweight object), in JDK1.2 there is still a bit of a cost ;(

JDK1.3 is inbetween though I believe there is a command line switch to enable 
a different GCs and I believe this may help a little.

> So, I also guess that simply writing :
>
> Category category = Category.getInstance(targetName);
>
> would be more performant ?

maybe or maybe not. There could be zero difference depending on the JVMs GC 
and quality of jit compiler. Best idea is to take a representative method. 
Run it for 10 minutes (to "warm" up the hotspot if thats what you are using 
it for) then test how many runs can occur in a minute (use 
NoopAppenders to ignore IO differences). Repeat this for each 
different version and you should an an okay representation of difference in 
performance.

However I think you will find that it is directly related to type of Appender 
rather than the object wrapper.

-- 
Cheers,

Pete

--------------------------------
 These aren't the droids you're 
 looking for. Move along. 
--------------------------------


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message