I've created a test harness for this as a leiningen plugin:
https://github.com/bendlas/lein-partest

You can just put

    :plugins [[net.bendlas/lein-partest "0.1.0"]]

into your project and run

    lein partest your.ns/testfn 6

to run 6 threads/processes in parallel

The plugin then runs the function as follows:

- (a default of) 2 warmup runs
- 6 times serially
- 6 times in parallel with futures
- 6 times in parallel with classloaders
- 6 times in parallel with processes

A run with the original function (with an i of 1000 instead of 10000) on my
machine reveals that running in separate classloaders yields roughly the
same times.
This hints at the bottleneck being in the JVM instead of the clojure
runtime, provided I have used the classloader feature of leiningen
correctly (please verify).
I'd be very interested in the performance on Azul's JVM.

> lein partest example/burn 4
##################### Run serial ... warmup ...
  #  0, elapsed:       187.57 msecs
  #  1, elapsed:       184.83 msecs
  #  2, elapsed:       183.99 msecs
  #  3, elapsed:       184.33 msecs
##################### Run parallel, same classloader ... warmup ...
  #  1, elapsed:      1063.02 msecs
  #  2, elapsed:      1071.12 msecs
  #  3, elapsed:      1091.50 msecs
  #  0, elapsed:      1100.42 msecs
##################### Run parallel, distinct classloaders ... warmup ...
 warmup ...
 warmup ...
 warmup ...
  #  2, elapsed:      1135.74 msecs
  #  3, elapsed:      1118.14 msecs
  #  1, elapsed:      1119.45 msecs
  #  0, elapsed:      1103.45 msecs
##################### Run parallel, distinct processes ... warmup ...
 warmup ...
 warmup ...
 warmup ...
  #  0, elapsed:       191.96 msecs
  #  2, elapsed:       209.49 msecs
  #  3, elapsed:       191.99 msecs
  #  1, elapsed:       201.93 msecs

-- 
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