Interesting problem, the slowdown seems to being caused by the reverse call
(actually the calls to conj with a list argument).
Calling conj in a multi-threaded environment seems to have a significant
performance impact when using lists
I created some alternate reverse implementations (the fastest uses a vector
and cons), the gist with the test code can be found at
https://gist.github.com/4243724
On a dual Xeon E5520 (8 physical cores) @ 2.27GHz with Linux runnning
OpenJDK 1.7.0_09 I got the following results:
fast-reverse : map-ms: 3.3, pmap-ms 0.7, speedup 4.97
list-cons : map-ms: 4.0, pmap-ms 0.7, speedup 6.13
vec-conj : map-ms: 4.0, pmap-ms 1.3, speedup 3.10
list-conj : map-ms: 10.8, pmap-ms 21.2, speedup 0.51
clojure-reverse : map-ms: 13.5, pmap-ms 26.8, speedup 0.50 (this is
equivalent to the original code)
The following JDK command line options were used:
"-Xmx20G" "-XX:MaxPermSize=8G" "-XX:+UseParallelGC"
"-XX:+UseParallelOldGC"
Some other notes:
I ran the sample under YourKit and garbage collection represents a small
percentage of execution time in both single and multi-threaded tests, there
are no blocked threads for the duration of the test and there is no
unexpected monitor/lock usage.
Cheers,
Cameron.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en