From: Thomas E Enebo Date: 2006-08-05T07:22:57+09:00 Subject: Re: For performance, fix the Java program On Sat, 05 Aug 2006, Jon Harrop defenestrated me: > Isaac Gouy wrote: > > Depending on the machine hardware, we should expect a vanilla Java > > implementation to take 1.5x - 2.5x longer than C for this problem. > > Only if by "vanilla" you mean optimised Java. Did you look at Isaac's implementation? It is almost exactly the same it was before, but he is not printing out the latin squares as unicode (which none of the other impls are doing to my knowledge) and it is writing to a BufferedReader (which any Java programmer with a couple months of experience would/should do). I think of things like manual loop unrolling and other similiar techniques as optimization techniques. The stuff he did was common sense and I think closer to the C impl in action (these languages are not the same -- some consideration should be taken in this). My only question on this thread about Java is what Java is being used for the test (used on the webpage -- a good addition to the page)? I ran Java 1.4, Java 5 and Java 6 (beta but what the hell). The speedup was surprising and exciting (obviously I do Java programming). I went from 1.1s to 0.84s between the versions. -Tom -- + http://www.tc.umn.edu/~enebo +---- mailto:enebo@acm.org ----+ | Thomas E Enebo, Protagonist | "Luck favors the prepared | | | mind." -Louis Pasteur |