From: Isaac Gouy Date: 2006-08-04T02:20:12+09:00 Subject: Re: For performance, fix the Java program Peter Hickman wrote: > Isaac Gouy wrote: > > 1) Over the past 3 or 4 days, people have said what's wrong with the > > way you're producing output in Java, and suggested what you should do > > instead. Is it that you don't know enough Java to follow their > > suggestions and fix the program? > > > So far the only language that has come close to running as fast as the C > is the Ocaml version and since then I have found other ways to speed up > the C version. Just as I have posted the Ruby and Ocaml version if any > certified Java expert cares to show me how it should be done (*cough* > Charles O Nutter *cough*) then I will be happy to time it and check the > output and report the results. So you don't know enough Java? > That way we can get away from all this > stupidity like the fact that I didn't use the correct naming convention. > Which we all know hugely affects performance. But remember that the > timings will be based on a program that produces output. > > A couple of days ago single measurements on my machine gave > > 0.820s user+sys, gcc -pipe -Wall -O3 -fomit-frame-pointer > > -funroll-loops -march=pentium4 > > 4.444s user+sys, sun-jdk-1.5.0.07 > > > > Simply writing Java that converts the double-byte Unicode Java > > outputStrings to single-byte /once/ instead of everytime there's a > > print statement, and following the usual Java pattern of wrapping > > output with a BufferedOutputStream, reduces that to > > > > 1.396s user+sys, sun-jdk-1.5.0.07 > > > > Yesterday I emailed you another version of your Java generating Perl > > script that fixes those print problems, the output matches the C > > program output. > > > If it was the email I replied to yesterday then reason that it got close > to the speed of the C version was because it didn't do any output. Once > I put the output back in it was only around 5 seconds faster than my own > Java version and around 15 seconds slower than the C version. Hardly > encouragement to drop C and pursue Java. Remember I am running the > program to get the output. If it didn't produce any output I would have mentioned that, as I have before. Check your email - the subject line reads " For performance use ascii output"