cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacomo <giac...@apache.org>
Subject Re: [C2]: Performance and logging
Date Thu, 09 Aug 2001 21:11:51 GMT
On Tue, 7 Aug 2001, Carsten Ziegeler wrote:

> Hi,
>
> I know that we had this discussion some time ago, with no real solution,
> so I thought: why not start it again?
>
> Looking at the way logging is performed in cocoon 2, I think this is
> not very fast. Here an example:
>
> <CODE>
>   getLogger().debug("Creating new Templates in " + this + " for " +
> this.inputSource.getSystemId());
> </CODE>
>
> Even if the priority debug is disabled, the method getLogger() (from
> AbstractLoggable) is called
> returning the logger, the expensive string concatenation is performed and
> the debug() method
> of the logger is called. And these steps are done for every debug message!
>
> We should change two things here:
> a) Replace the getLogger() call with the use of an instance variable logger.
>    This requires to make an own AbstractLoggable class which offers the
> logger as an instance
>    variable and not via a method.

-1 I don't see you'll gain any performance. As the getLogger method of
the AbstractLoggable is final it is subject for inlining the logger
reference.

> b) Before logging testing the priority.

I had this issue many month ago. So I've tested a C2 version which had
NO logging statements at all in the code against a normal one at
loglevel DEBUG. The speed difference was about 5-7% which will mostly
result because of the I/O operations during the logging. At loglevel
FATAL_ERROR there was no significant difference. I confess that since
that time there has been more logging statement introduced and of course
complex string manipulations to create a log message should be enclosed
in snippets like below. But sure I can easily give a +1 for this.

Giacomo

>
> So the example above should read:
>
> <CODE>
>   if (this.logger.isDebugEnabled() == true) {
>     this.logger.debug("Creating new Templates in " + this + " for " +
> this.inputSource.getSystemId());
>   }
> </CODE>
>
> Comments? Ideas? Suggestions? Volunteers?
>
>
> Carsten
>
> Open Source Group                        sunShine - b:Integrated
> ================================================================
> Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> www.sundn.de                          mailto: cziegeler@sundn.de
> ================================================================
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message