From owner-freebsd-java Fri Dec 1 17:32:30 2000 Delivered-To: freebsd-java@freebsd.org Received: from heinz.jollem.com (c104187.upc-c.chello.nl [212.187.104.187]) by hub.freebsd.org (Postfix) with ESMTP id CD00C37B400 for ; Fri, 1 Dec 2000 17:32:20 -0800 (PST) Received: (from ernst@localhost) by heinz.jollem.com (8.11.1/8.9.3) id eB21VSm64559; Sat, 2 Dec 2000 02:31:28 +0100 (CET) (envelope-from ernst) Date: Sat, 2 Dec 2000 02:31:28 +0100 From: Ernst de Haan To: Nate Williams Cc: FreeBSD Java mailing list Subject: Re: Performance hint for JDK on FreeBSD Message-ID: <20001202023128.A62998@c187104187.telekabel.chello.nl> References: <59063B5B4D98D311BC0D0001FA7E4522026D7A7D@l04.research.kpn.com> <20001201174923.A57144@c187104187.telekabel.chello.nl> <20001201185031.A58178@c187104187.telekabel.chello.nl> <20001201190827.A59487@c187104187.telekabel.chello.nl> <14887.59899.440931.811907@nomad.yogotech.com> <20001201192313.A59625@c187104187.telekabel.chello.nl> <20001202013654.A61526@c187104187.telekabel.chello.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20001202013654.A61526@c187104187.telekabel.chello.nl>; from ernst@jollem.com on Sat, Dec 02, 2000 at 01:36:54AM +0100 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Oops, I didn't include the new AWTTest.java file :) Here it is. And I included a compiled version too. Ernst Ernst de Haan wrote: > Ok, I tested the JDK 1.1.8 with the AWTTest utility, and I wrote a new program > to see if the creation of a java.awt.Frame would perhaps take a longer amount > of time on 1.1.8. Not. It seems JDK 1.1.8 just perhaps heaps better than > 1.2.2... > > I tested with a number of JDK's, all on my P2-400, 256 MB, 16 bit-color (!), > XFree86 4.0.1f: > > * JDK 1.1.8/FreeBSD > * JDK 1.2.2b9/FreeBSD > * JDK 1.2.2b10/FreeBSD > * JDK 1.3.0_01/Linux (Sun) > * JDK 1.2.2rc4/Linux (Blackdown) > > Here's three tables with run results, the column headers contain the run #. > > Class load 1 2 3 4 > ---------------------------+------+------+------+------+ > 1.1.8/FreeBSD | 46 | 47 | 45 | 46 | > 1.2.2b9/FreeBSD | 142 | 142 | 142 | 142 | > 1.2.2b10/FreeBSD | 167 | 167 | 168 | 168 | > 1.3.0_01/Linux (Sun) | 443 | 437 | 437 | 438 | > 1.2.2rc4/Linux (Blackdown) | 315 | 313 | 315 | 314 | > > AWT startup 1 2 3 4 > ---------------------------+------+------+------+------+ > 1.1.8/FreeBSD | 44 | 44 | 43 | 42 | > 1.2.2b9/FreeBSD | 444 | 444 | 445 | 455 | > 1.2.2b10/FreeBSD | 437 | 438 | 444 | 451 | > 1.3.0_01/Linux (Sun) | 415 | 415 | 413 | 414 | > 1.2.2rc4/Linux (Blackdown) | 1064 | 1070 | 1067 | 1063 | > > Frame create 1 2 3 4 > ---------------------------+------+------+------+------+ > 1.1.8/FreeBSD | 17 | 19 | 17 | 18 | > 1.2.2b9/FreeBSD | 13 | 13 | 14 | 14 | > 1.2.2b10/FreeBSD | 11 | 11 | 12 | 12 | > 1.3.0_01/Linux (Sun) | 12 | 12 | 12 | 12 | > 1.2.2rc4/Linux (Blackdown) | 11 | 11 | 11 | 11 | > > What surprises me most is that the native 1.1.8 was so fast. And I wonder why > the native 1.2.2b10 is just a bit slower than the older b9. > > Ernst > > > Ernst de Haan wrote: > > Look twice, it's there :) > > > > 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. > > > > > > For those of us who are absolutely paranoid, can you send the original > > > .java file? I *hate* running binaries on my system that I know nothing > > > about. (No offense, to Ernst in implying that he's trying to breakin). > > > > > > Also, having the source allows it to be used for profiling when we do > > > additional ports and such. > > > > > > Thanks! > > > > > > > > > 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. > > > > > 6 1.33% 58.71% 1 1275 sun/awt/font/NativeFontWrapper.registerFonts > > > > > 7 1.21% 59.93% 8184 867 java/lang/Throwable. > > > > > 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 > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-java" in the body of the message > --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="AWTTest.java" public class AWTTest { public static void main(String[] args) throws Exception { // Load the Toolkit and Frame classes from the AWT package long beforeClassLoad = System.currentTimeMillis(); Class c1 = Class.forName("java.awt.Toolkit"); Class c2 = Class.forName("java.awt.Frame"); long afterClassLoad = System.currentTimeMillis(); // Get the getDefaultToolkit() class function java.lang.reflect.Method m1 = c1.getMethod("getDefaultToolkit", null); java.lang.reflect.Constructor m2 = c2.getConstructor(null); // Invoke the getDefaultToolkit() class function long beforeInvoke = System.currentTimeMillis(); m1.invoke(null, null); long afterInvoke = System.currentTimeMillis(); // Create a frame long beforeFrameCreate = System.currentTimeMillis(); m2.newInstance(null); long afterFrameCreate = System.currentTimeMillis(); long t1 = afterClassLoad - beforeClassLoad; long t2 = afterInvoke - beforeInvoke; long t3 = afterFrameCreate - beforeFrameCreate; System.out.println("Class load took: " + t1 + " ms."); System.out.println("AWT startup took: " + t2 + " ms."); System.out.println("Frame create took: " + t3 + " ms."); System.exit(0); } } --IJpNTDwzlM2Ie8A6 Content-Type: application/octet-stream Content-Disposition: attachment; filename="AWTTest.class" Content-Transfer-Encoding: base64 yv66vgADAC0AZwcAAgEAB0FXVFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAEbWFpbgEA FihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAApFeGNlcHRpb25zBwAJAQATamF2YS9sYW5nL0V4 Y2VwdGlvbgEABENvZGUBAA9MaW5lTnVtYmVyVGFibGUMAA0ADgEAEWN1cnJlbnRUaW1lTWls bGlzAQADKClKCgAQAAwHABEBABBqYXZhL2xhbmcvU3lzdGVtCAATAQAQamF2YS5hd3QuVG9v bGtpdAwAFQAWAQAHZm9yTmFtZQEAJShMamF2YS9sYW5nL1N0cmluZzspTGphdmEvbGFuZy9D bGFzczsKABgAFAcAGQEAD2phdmEvbGFuZy9DbGFzcwgAGwEADmphdmEuYXd0LkZyYW1lCAAd AQARZ2V0RGVmYXVsdFRvb2xraXQMAB8AIAEACWdldE1ldGhvZAEAQChMamF2YS9sYW5nL1N0 cmluZztbTGphdmEvbGFuZy9DbGFzczspTGphdmEvbGFuZy9yZWZsZWN0L01ldGhvZDsKABgA HgwAIwAkAQAOZ2V0Q29uc3RydWN0b3IBADMoW0xqYXZhL2xhbmcvQ2xhc3M7KUxqYXZhL2xh bmcvcmVmbGVjdC9Db25zdHJ1Y3RvcjsKABgAIgwAJwAoAQAGaW52b2tlAQA5KExqYXZhL2xh bmcvT2JqZWN0O1tMamF2YS9sYW5nL09iamVjdDspTGphdmEvbGFuZy9PYmplY3Q7CgAqACYH ACsBABhqYXZhL2xhbmcvcmVmbGVjdC9NZXRob2QMAC0ALgEAC25ld0luc3RhbmNlAQAnKFtM amF2YS9sYW5nL09iamVjdDspTGphdmEvbGFuZy9PYmplY3Q7CgAwACwHADEBAB1qYXZhL2xh bmcvcmVmbGVjdC9Db25zdHJ1Y3RvcgwAMwA0AQADb3V0AQAVTGphdmEvaW8vUHJpbnRTdHJl YW07CQAQADIHADc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AABAAQAAQABAGUAAAACAGY= --IJpNTDwzlM2Ie8A6-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message