JDK-7163898 : add isLoggable() check to doLog()
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-04-24
  • Updated: 2013-07-31
  • Resolved: 2012-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b38Fixed
Description
Moving the mouse pointer over a java.awt.Window using JRE7 consumes
aprox. twice the CPU time as with JRE6 when logging is used (when a call
to java.util.logging.getLogger(String)---even without using the returned
Logger--- has been done). Keyboard key event processing suffers the same
performance penalty. For steps to reproduce this problem please look at:
http://www.java.net/forum/topic/performance/general-performance-discussion/jre7s-javaawt-performance-degradation-caused-javautillogging-linux
.

The performance degradation seems to be "enabled" by the call of
sun.util.logging.PlatformLogger.redirectPlatformLoggers() done inside
java.util.LogManager.readPrimorialConfiguration() on JRE7. Call chain: 
Logger.getLogger()->LogManager.getLogManager()->
LogManager.readPrimordialConfiguration()->sun.util.logging.PlatformLogger.redirectPlatformLoggers().

This call is not made on JRE6. If this problem is not easy to solve then
I guess is better to remove this call from JRE7's
readPrimordialConfiguration as it does more harm than good.

Please let me know if there is a better place to report this problem. A
couple of weeks ago I "opened" a bug report on bugs.sun.com but I
received no response at all.

Reported on jdk7u-dev@:
http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-April/002667.html

Comments
EVALUATION http://cr.openjdk.java.net/~anthony/8-30-doLog-7163898.0/ Pushed to awt-gate forest: http://hg.openjdk.java.net/jdk8/awt/jdk/rev/9ed029a0326d
24-04-2012

EVALUATION In cases when we don't build complex strings for logging in AWT code, we don't usually guard such logging statements with if (...loggable...) checks. The suggested change will address these specific cases by eliminating some internal string building operations in the logger code itself, thus boosting performance even further. http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-April/002707.html
24-04-2012