Date: Sat, 2 Dec 2000 01:06:59 +0100 From: Ernst de Haan <ernst@jollem.com> To: Nate Williams <nate@yogotech.com> Cc: FreeBSD Java mailing list <freebsd-java@FreeBSD.ORG> Subject: Re: Performance hint for JDK on FreeBSD Message-ID: <20001202010659.A61295@c187104187.telekabel.chello.nl> In-Reply-To: <14888.1179.861868.150322@nomad.yogotech.com>; from nate@yogotech.com on Fri, Dec 01, 2000 at 01:05:47PM -0700 References: <59063B5B4D98D311BC0D0001FA7E4522026D7A7D@l04.research.kpn.com> <20001201174923.A57144@c187104187.telekabel.chello.nl> <20001201185031.A58178@c187104187.telekabel.chello.nl> <20001201190827.A59487@c187104187.telekabel.chello.nl> <14888.1179.861868.150322@nomad.yogotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Nate, Yes, I'm doing the tests locally on a P2-400 system, recent FreeBSD 4.2-S, 256 MB internal, XFree86 4.0.1f, FreeBSD JDK 1.2.2b10, no JIT. Those numbers for JDK 1.1 are pretty nifty! Wow, I should test that too! Your JDK 1.1 port seems very resource-effective! Ernst Nate Williams wrote: > > Ok, the votes are counted, the results are in :) I've written a small Java > > program I wrote to produce new test results that should be reproducable on > > other (FreeBSD) systems too. I've included the .java file in an attachment, > > and, for your convenience, the AWTTest.class file. > > > > Question: Are you running this program on your 'local' client (with the > DISPLAY environment variable set to :0)? If not, the AWT startup will > be greatly effected, since AWT startup does some X stuff behind the > scenes, which may take longer if it involves network traffic. > > > In the program I do 2 things. First I attempt to load the class > > java.awt.Toolkit. Then I invoke the class function getDefaultToolkit(), which > > apparently initializes AWT. > > > > Here are the results (I did only one run): > > > > Original Applied suggested modifications > > -------- ------------------------------- > > Class load: 155 ms. 154 ms. > > AWT startup: 2454 ms. 437 ms. > > > > That's quite a difference, isn't it? :) Could anyone confirm these > > results for his/her system? > > Running JDK1.1.8 on my box I get: > nomad:~/roof/dpr/src/dpr % java AWTTest > Class load took: 8 ms. > AWT startup took: 24 ms. > > Pretty darn quickly, but it's a fairly speedy box. I won't post the > Alpha numbers because I'm doing all the X stuff remotely. > > > Nate > > > Ernst de Haan wrote: > > > Heya Kees-Jan and all, > > > > > > > > > > > I never knew that it is a 400% performance boost, which does sound a little > > > > > strange. I'm really curious why that is. > > > > > > > > Well, I turned on profiling, and found that most of the time is spent in X11 > > > > specific Java code. I will re-run the tests after I temporarily disabled your > > > > suggested modifications. > > > > > > Okay, I did a little profiling (using -Xrunhprof:cpu=times). This is the top > > > 10 when I dont have the modified font.properties file: > > > > > > CPU TIME (ms) BEGIN (total = 29358) Fri Dec 1 17:55:12 2000 > > > rank self accum count trace method > > > 1 24.71% 24.71% 253952 1304 sun/io/CharToByteSingleByte.getNative > > > 2 16.04% 40.76% 8188 1399 sun/io/CharToByteSingleByte.convert > > > 3 12.93% 53.69% 253952 182 java/lang/String.charAt > > > 4 2.25% 55.94% 8184 620 java/lang/Throwable.fillInStackTrace > > > 5 1.44% 57.38% 8258 938 java/lang/String.<init> > > > 6 1.33% 58.71% 1 1275 sun/awt/font/NativeFontWrapper.registerFonts > > > 7 1.21% 59.93% 8184 867 java/lang/Throwable.<init> > > > 8 1.08% 61.01% 10958 153 java/io/StreamTokenizer.read > > > 9 1.07% 62.08% 10958 623 java/io/BufferedInputStream.read > > > 10 0.91% 62.99% 318 123 java/util/Properties.loadConvert > > > > > > The traces for the top 3 are: > > > > > > TRACE 1304: > > > sun/io/CharToByteSingleByte.getNative > > > sun/io/CharToByteSingleByte.convert > > > sun/awt/font/NativeFontWrapper.registerFonts > > > sun/awt/X11GraphicsEnvironment.registerNativeFonts > > > > > > TRACE 1399: > > > sun/io/CharToByteSingleByte.convert > > > sun/awt/font/NativeFontWrapper.registerFonts > > > sun/awt/X11GraphicsEnvironment.registerNativeFonts > > > sun/java2d/SunGraphicsEnvironment$2.run > > > > > > TRACE 182: > > > java/lang/String.charAt > > > sun/io/CharToByteSingleByte.getNative > > > sun/io/CharToByteSingleByte.convert > > > sun/awt/font/NativeFontWrapper.registerFonts > > > > > > Here are the startup times for AWT: > > > > > > Original: w/modifications: > > > ---------------- ------------------------------ > > > run 1: 2607 ms 608 ms > > > run 2: 2579 ms 573 ms > > > run 3: 2583 ms 601 ms > > > run 4: 2713 ms 599 ms > > > > > > Note: The only modifications performed are adding the URW fonts to my > > > XF86Config and using the font.properties from Kees-Jan's site instead of the > > > original one! > > > > > > Here is the top 10 of CPU time eaters for my application with the > > > modifications applied: > > > > > > CPU TIME (ms) BEGIN (total = 9169) Fri Dec 1 17:46:56 2000 > > > rank self accum count trace method > > > 1 2.91% 2.91% 318 110 java/util/Properties.loadConvert > > > 2 2.75% 5.66% 252 109 java/util/Properties.loadConvert > > > 3 2.25% 7.91% 5 158 java/util/Properties.load > > > 4 1.98% 9.89% 6356 987 java/lang/String.indexOf > > > 5 1.73% 11.63% 5479 584 java/io/BufferedInputStream.read > > > 6 1.73% 13.36% 5479 142 java/io/StreamTokenizer.read > > > 7 1.49% 14.85% 8590 203 java/lang/StringBuffer.append > > > 8 1.42% 16.27% 8590 675 java/lang/String.charAt > > > 9 1.41% 17.68% 8133 946 java/lang/StringBuffer.append > > > 10 1.36% 19.04% 8133 207 java/lang/String.charAt > > > > > > Now all of a sudden my application code comes on top. And that's the way I > > > like it! :) > > > > > > IMHO these results are quite amazing! > > > > > > Next thing I'll do is write a small program that will do nothing but starting > > > AWT and displaying the startup times, as the current results are obtained by > > > looking at the log output of my own Swing application. > > > > > > > > > Ernst > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > with "unsubscribe freebsd-java" in the body of the message > > > > > public class AWTTest { > > > > public static void main(String[] args) throws Exception { > > > > // Load the Toolkit class from the AWT package > > long beforeClassLoad = System.currentTimeMillis(); > > Class c = Class.forName("java.awt.Toolkit"); > > long afterClassLoad = System.currentTimeMillis(); > > > > // Get the getDefaultToolkit() class function > > java.lang.reflect.Method m = c.getMethod("getDefaultToolkit", null); > > > > // Invoke the class function > > long beforeInvoke = System.currentTimeMillis(); > > m.invoke(null, null); > > long afterInvoke = System.currentTimeMillis(); > > > > long t1 = afterClassLoad - beforeClassLoad; > > long t2 = afterInvoke - beforeInvoke; > > > > System.out.println("Class load took: " + t1 + " ms."); > > System.out.println("AWT startup took: " + t2 + " ms."); > > System.exit(0); > > } > > } > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001202010659.A61295>