On Tue, Jan 27, 2009 at 3:04 AM, Keith Bennett <keithrbenn...@gmail.com> wrote:
>
> All -
>
> I tried testing the code at http://clojure.org/Refs to see what the
> benefit of multicore processing would be.  To my surprise, the my-pmap
> function took *more* time, not less, than the map function.
>
> Whereas the times listed in the article were approximately 3.1 and 1.7
> seconds, on my MacBookPro 2.33 GHz Intel Core 2 Duo laptop, my times
> were 14.9 and 15.1 seconds.
>
> What is the correct interpretation of these results?  Does one need
> more than 2 CPU's to see a benefit?  Or is the Mac JVM only using one
> CPU instead of two?  Or...?
>
> ...and is there something wrong with my setup that both took so long?
>

It might simply mean that the raw single-thread performance of your
CPU in this case is cheaper than the cost of the bookkeeping involved
in the parallelization of the algorithm.

You might see better results if you try playing with the size of the
invocations to (partial ack 3), maybe something like;

  (time (reduce + (my-pmap (partial ack 5) (replicate 1000 10))))

I kept blowing my stack when trying higher numbers like this so I'm
not sure if you'll see this or not. On my system I did see that the
parallel version was faster for the invocation shown on the
http://clojure.org/Refs page, however if I reduced the size of the
computation then the single-thread map began to win:

user=> (time (reduce + (map (partial ack 1) (replicate 1000 2))))
"Elapsed time: 1.419 msecs"
4000
user=> (time (reduce + (my-pmap (partial ack 1) (replicate 1000 2))))
"Elapsed time: 35.599 msecs"
4000


/mike.

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