From: Charles O Nutter Date: 2006-08-03T03:16:46+09:00 Subject: Re: For performance, write it in C - Part 3, Source code now available ------=_Part_70416_25149379.1154542604250 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/2/06, Isaac Gouy wrote: > > 1) I made some changes to the jen.pl script you used to generate the > Java program, it now splits apart the array initialization into many > different methods - and that will let you generate a Java program for > 6x6. I emailed it to you. That's pretty helpful...the old version was gigantic even for 5x5. A better way might be to write the Perl script in Java and generate the array at runtime, rather than generating some pretty weird Java code. It would be pretty fast for all sizes that are computable on modern machines with this algorithm. 2) By "benchmarking without analysis is bogus" I understand that > without analysis the programs might not be doing what we think they are > doing - what we think is an apples to apples comparison might not be an > apples to apples comparison. Exactly my point. The Java version was automatically crippled because it had to do far more work than the C version, owing both to always-on Java features (unicode support) and to the author's attempts to "work around" various restrictions in creative ways (initializing the array at runtime). The IO bit turned out to be the worst part, however, and when it was removed the Java version beat the C version handily (on my opteron box, anyway). On a side note: holy crap is Java 6 fast. Those numbers surprised even me. 3) There seems to be a bigger problem with using this latin squares > algorithm for benchmarking - the computation explodes! > > 0.496s gcc 5x5 (without print statements) > 30055.098s gcc 6x6 (without print statements) You have more patience than I. I killed it after the first couple hours and after a visit to Wolfram told me it would take a long time. -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn JRuby Developer @ www.jruby.org Application Architect @ www.ventera.com ------=_Part_70416_25149379.1154542604250--