Here are the results of running (3 times): time -f '%P' java PerformanceRegressionTest2 useLogging on my laptop using different JREs:
JRE6: 13%, 13%, 12% JRE7: 20%, 22%, 22% JRE7*: 12%, 11%, 12% JRE7_u4: 12%, 13%, 13% JRE8: 13%, 14%, 14% where: JRE6: java version "1.6.0_30" Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) Server VM (build 20.5-b03, mixed mode) JRE7: java version "1.7.0_03" Java(TM) SE Runtime Environment (build 1.7.0_03-b04) Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode) JRE7*: is the same JRE7 but the test was run without logging enabled: time -f '%P' java PerformanceRegressionTest2 JRE7_u4: java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b20) Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode) JRE8: java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b34) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b07, mixed mode) Cheers, Nicolas On 04/18/2012 03:56 AM, Alan Bateman wrote: > On 18/04/2012 02:01, Nicolas Carranza wrote: >> Federico's patch solves the performance regression (see: >> http://mail.openjdk.java.net/pipermail/jdk7u-dev/2012-April/002694.html >> ). But instead of this patch I find better to change the PlatformLogger >> class: insert "if(!isLoggable(level)) return;" at the beginning of the >> method sun.util.logging.PlatformLogger.JavaLogger.doLog(int level, >> String msg, Object... params) . The string convertion affecting the >> performance is done on the PlatformLogger.JavaLogger.doLog (even when >> the message is not loggable) and it is there where the problem should be >> fixed (to be more clear and also cover more use cases). Fixing it there >> also clears why the performance regression does not happen when >> redirectPlatformLoggers has not been called (when logging is not used): >> PlatformLogger.LoggerProxy.doLog(int level, String msg, Object... >> params) does not do the string convertion when the message is not >> loggable. >> >> Federico's patch has already been pushed to the jdk8 repository, when >> will it be applied to jdk7 (or my propossed change if it is preferred)? >> >> [ Here is a jvisualvm memory profiling snapshot of >> PerformanceRegresionTest3: >> http://www.java.net/forum/topic/performance/general-performance-discussion/jre7s-javaawt-performance-degradation-caused-javautillogging-linux#comment-823486 >> >> . ] >> >> Cheers, >> Nicolas > I'm curious to know if you have you re-tested the performance with a > recent build of 8 or 7u4 that has the AWT fix? It would be interesting > to see then if the checking the logging level make an observable > difference or not. > > -Alan >
