On 20/03/14 04:03, Andy C wrote:
So, the following test puzzles me. Not because it takes virtually the same time (I know that Fork/Join is not cheap and memory is probably the biggest bottleneck here). But because I do not get why map (as opposed to r/ma) uses all 8 cores on my MacBookPro. All of them seem to be running according to Activity Monitor at more less the same level.

user=> (def l (into [] (range 60000000)))
#'user/l
user=> (time (def a (doall (map #(Math/sin (* % %)) l))))
"Elapsed time: 19986.18 msecs"

user=> (time (def a (doall (into [] (r/map #( Math/sin (* % %)) l)))))
"Elapsed time: 18980.583 msecs"
I would also expect this code to run on a single CPU at any one time, however process/thread scheduling can make this thread run on different cores at different times. Depending on the sampling method the activity monitor may display another picture of what you would expect. On my linux machine, the cpu history graph shows it's using mostly one cpu at any one time, but it's not always the same cpu. I think the JVM uses all cores by default, and there's no standard way to specify thread affinity <http://stackoverflow.com/questions/2238272/java-thread-affinity>.


--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to