Toby, Yoav,

Thanks for the responses.  

Yoav:

Thanks for explaining the Hierarchy.setThreshold()
method - if I was to change the config to effectively
set this would I get a performance gain?  I would
prefer not to have to call this method in Java and
would like to do this via configuration.

Toby:

You are right, I shouldn't have been mixing properties
files with xml files, it wasn't a fair comparison.  I
have changed to using both properties files.  

I have also updated the code to explicitly display the
time taken to execute just the Log4J and JDK 1.4 code
using direct calls to Date().getTime().  Strictly
speaking this was not necessary as I was reusing the
JUnitPerf classes from Mike Clark (www.clarkware.com).
 JUnitPerf is an Open Source add on to JUnit that
allows you to measure the performance of JUnit tests,
as I was initialising the Logger in the constructor of
the JUnit TestCase class and not in the method that
JUnitPerf was timing the differences between
properties and xml config files shouldn't have made a
difference.  Anyway for clarity its changed now and
you can run each test directly.

I also take your point that "benchmarking by
iteration" is not the best way to measure the overall
performance of Log4J however the specific test that I
am performing here is to understand the difference in
duration between leaving JDK 1.4 and Log4J logging
code in place and configuring it not to log any
messages.  As I said before the only reason that I am
iterating 10 million times is to get a significantly
measurable result as to perform the division and
calculate the cost of leaving a single logging
statement that is configured not to log.

Unfortunately the changes didn't make any difference
to the results, this time for 10 million iterations it
was:

JDK 1.4 : 441 ms
Log4J   : 901 ms

I think that this illustrates that for a comparable
test where the general configuration of both JDK 1.4
and Log4J is to log messages BUT a specific class has
been configured NOT to log that JDK 1.4 is faster.  If
Log4J was enhanced to check earlier comparable
performance results could be acheived.

I have attached my updated tests and config.

Thanks again,

David


--- Toby Butzon <[EMAIL PROTECTED]> wrote:
> David McVicar wrote:
> 
> > The tests are configured using log4j.xml (Log4J)
> and 
> > logging.properties (JDK 1.4).
> 
> You should either (a) time JUST the log() method
> calls or (b) use the 
> same kind of configuration file in both tests. XML
> is significantly 
> harder to process than the .properties format. So,
> try using 
> log4j.properties and let's see what your timing
> results are then.
> 
> Also try timing ONLY the loop and not the
> initialization. You should be 
> able to use ``new java.util.Date().getTime()''
> before and after the 
> loop, subtracting the two values to get the elapsed
> time in 
> milliseconds. (It'd be nice to have nano precision,
> but that's not 
> supported; you could do it natively, if you were
> keen on it.)
> 
> Note also that benchmarking by iteration is not
> usually the best way to 
> do it; though it seems to sheild you from having to
> think about other 
> factors, looping differs a good bit from normal
> usage, so it won't 
> necessarily reflect actual real-world performance.
> 
> -- 
> Toby Butzon <[EMAIL PROTECTED]>
> ILC R&D Co-op / Georgia Tech CS / KKPsi Iota Sp03
> 678.904.2413 work / 678.362.6483 mobile
> Fifteen Piedmont Center, Suite 700 / Atlanta, GA
> 30305
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

Attachment: log4jnotlogging V1.1.zip
Description: log4jnotlogging V1.1.zip

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to