← Back to team overview

openjdk team mailing list archive

Bug#651423: Bug#651423: openjdk-7-jre: X11 support in Java wastes CPU for (disabled) logging

 

Hi,
A quick follow-up.

> This patch has been merged into JDK8 mercurial repository :
> http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/7636a62aba7e

There might be more related fixes. Upon further profiling, I found
there are more performance issues associated with the new
PlatformLogger vom JDK7.
They might be neglible, but given that they show up when profiling a
Batik application I wouldn't bet on that.
I don't remember exactly which class it was, but it contained a couple
of log.finest(""); statements with empty strings; essentially method
entry logging.
Wrapping these with an if() doesn't help much; ideally this would be
happening in log.finest anyway.
However, when looking at the PlatformLogger, I found out that even
testing whether logging at a particular level is enabled causes an
undesirably heavy roundtrip:
the actual level - an int - is converted to an Integer, then looked up
in a HashMap to find the Level object to test. This is one thing all
other logging APIs seem to avoid at all cost, having to do a hashmap
lookup for every single logging call.
The PlatformLogger API of JDK7 seems a bit ad-hoc here; I don't
understand the reasoning why it was introduced in the first place,
actually. (It was something along the lines of splitting out
java.util.logging into a separate package; but if that is at the cost
of recreating it with yet another name?!?)

Anyway, the patch seems to speed up Java UI applications for me, is
upstream-approved and side effect free. Thank you for considering it
for the next package update.

Regards,
Erich





References