On Feb 10, 2011, at 1:41 PM, Bill James wrote:

On Feb 10, 2:47 pm, Isaac Gouy <igo...@yahoo.com> wrote:
On Feb 10, 1:17 am, Bill James <w_a_x_...@yahoo.com> wrote:

http://shootout.alioth.debian.org/u32/benchmark.php? test=fasta〈=all

The fastest program shown here is in Java and runs in 1.72 seconds.
However, at the bottom of the page (under "interesting alternative"
programs) there is a C++ program that runs in 0.25 seconds; it seems
to work basically the same way that my program does.

So this Clojure program will probably be relegated to the bottom of
the page.

Should it be relegated to the bottom of the page?

The C++ program was evidently deprecated because it did not go through
the process of generating a random character for each character that
it output. The author realized that the pseudo-random-number-generator
had a cycle-length less than 200_000.

Both the C++ program and the Clojure program use a much more efficient
algorithm than the other programs.  That may violate the rules.

If that was the reason it was deprecated, then it makes sense. It would be nice if the rules for that problem made it more explicit that this was not allowed.

I made a modified version of the program that calls the random number generator for every separate character output (for the two sequences that should be randomly generated), and unfortunately the run time is back up to about the same as the current fastest program on the web site, which unfortunately is 6x to 8x slower than the best Java program.

I've published that program at the link below. It contains comments marking two lines in the function gen-random-fast where the Hotspot JVM profiler tells me that the CPU is spending lots of time in java.lang.Integer.valueOf (Clojure 1.2.0). I can't seem to get rid of these calls to Integer.valueOf even after trying about half a dozen different variations of type-hinting. Can anyone else see a way to change the program to avoid those calls?

http://github.com/jafingerhut/clojure-benchmarks/blob/master/fasta/fasta.clj-10.clj

Thanks,
Andy

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to