I've done a pass through most of the Clojure programs on the shootout web site recently, making some of them faster, and choosing -Xmx command line arguments when running them to keep the memory usage down to a reasonable level -- not always the smallest heap size that works, mind you -- just one that avoids exorbitantly large memory usage.

http://shootout.alioth.debian.org

The Clojure program for the "fasta" problem, with source code, AOT compilation command, and execution command given on this web page:

http://shootout.alioth.debian.org/u32/program.php?test=fasta&lang=clojure&id=3

still takes about 6x to 8x more time than the best Java 6 -server program here, depending upon which of the four machines it is run on:

http://shootout.alioth.debian.org/u32/program.php?test=fasta&lang=java&id=3

I'm sure the Clojure program can be made faster, e.g. by doing fewer calls to write to the output file, with more bytes per call. Most of the time seems to be file writing and generating random numbers in gen- random!, at least on my systems where I've done testing and profiling. I'm also seeing a fair amount of time spent in calls to java.lang.Double.valueOf, according to the built-in profiler that comes with the Hotspot JVM.

Note: The web site is Clojure 1.2 only right now, so don't expect a tweaked-out program using things that only work in Clojure 1.3 to work there yet. Other tips:

+ Test your program by comparing its output to the Java program with the same command line args. The Java program isn't guaranteed to be bug free, but it has been tested a fair amount.

+ If you decide to submit, please take some time to select a -Xmx max heap size argument that gives a good tradeoff between low memory use and not too much extra time spent doing GC because of it. I've got some scripts to help automate finding such a value if you are interested, and I'd even volunteer to run them for you if you send me your program. Still, it is straightforward to do by hand, too -- no rocket science involved.

You are of course free to work on any of the problems you wish, but I just wanted to point out this one as being what I consider a bit stubborn to squeeze down the run time.

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