Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Some code to test the performance of the implementation of STM in Clojure

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.org
Octocat-spinner-32 project.clj
README.org

Status

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.

How to run

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

(load-file "src/clj_stm_perf_test/core.clj")

If you want to run (almost) all function, use

(clj-stm-perf-test.core/run-all)

Oh my god, it’s full of constants

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.

Further Reading

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.

License

Copyright (C) 2011 Stefan Kamphausen

Distributed under the Eclipse Public License, the same as Clojure. See file COPYING.

Something went wrong with that request. Please try again.