Hi all,

recently I did some micro-benchmarks of parallel code on my 8-core
computer. But I don't get the point about this behaviour of pmap. Can
anyone explain this to me? The code is running on a dual quad-core
intel machine (Xeon X5482, 3.20 GHz).

(defn maptest [cores] (doall (map (fn [x] (dotimes [_ 1000000000] (inc
0))) (range len))))
(defn pmaptest [cores] (doall (pmap (fn [x] (dotimes [_ 1000000000]
(inc 0))) (range len))))
leads to:
(time (maptest 8))   : 20804.182202 msecs
(time (pmaptest 8)) : 2567.521341 msecs
i.e. a speedup of ~8.

Doing this with doubles:

(defn maptest [cores] (doall (map (fn [x] (dotimes [_ 1000000000] (inc
0.1))) (range len))))
(defn pmaptest [cores] (doall (pmap (fn [x] (dotimes [_ 1000000000]
(inc 0.1))) (range len))))
leads to:
(time (maptest 8))   : 68044.060324 msecs
(time (pmaptest 8)) : 35051.174503 msecs
i.e. a speedup of ~2.

However, the CPU usage indicated by "top" is ~690%. What does the CPU
do?

Regards,

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