This is just a quick hack. I tried to come up with more sophisticated functions which would drive the STM machine into the various corners available. However, those functions I could come up with, which would do this in a repeatable, reliable way, would all use (Thread/sleep x) which lead to the benchmarks depending mainly on those sleep times.
Note, that the projects calls Clojure 1.2.1 as its dependency. Usually I will use a Clojure compiled from the sources and run its very basic REPL with
java -cp path/to/my/compiled/clojure.jar:. clojure.main
from the top of this project. If you want to use a parallel garbage collector, you may want to try
java -cp path/to/my/compiled/clojure.jar:. -XX:+UseParallelGC clojure.main
However, on my machines a parallel GC gave only about 2% speedup.
Then I ususally paste the functions from this project and look how they perform. Only the development of the functions is done with swank and slime.
To load the complete benchmark suite you can issue
If you want to run (almost) all function, use
Yes, there is actually lots of seemingly magic numbers in there. All these were chosen so that the benchmark runs well on the machines that i have access to. Most importantly there were no visible improvements from HotSpot to spot anymore.
Everyone loves to cite Mark Volkmans still valid article at http://java.ociweb.com/mark/stm/article.html however, I think we should add a recent Master’s Thesis by Peder R. L. Nielsen and Patrick T. Kristiansen to the list of important resources for details on Clojure’s STM: http://vbn.aau.dk/files/32587755/report.pdf
These guys did an awesome job.
Copyright (C) 2011 Stefan Kamphausen
Distributed under the Eclipse Public License, the same as Clojure. See file COPYING.