I'd be very thankful if I could get some advice here, sicne I am running out of ideas.

You might be doing something wrong with the way you're arranging refs. I'll let others comment on that.

One observation, though: parallelization doesn't always help. pmap runs your tasks on several threads. If your tasks are compute-bound and modifying a shared resource, you'll probably see a net slowdown thanks to coordination overhead, cache trampling, and contention.

Imagine the worst case, where you have 1 or 2 processors (and thus pmap uses three or four threads), and each of the four threads takes a turn, contends for the same ref, maybe swaps out, makes a conflicting change and causes a transaction rerun, swaps out...

Running serially removes both the risk of contention and the coordination overhead.

In general: use pmap if you have a lot of processors that you want to use, or you're doing tasks that spend a lot of time waiting around (e.g., web crawling). For pure computation on small datasets and desktop quantities of processors -- like munging game state -- it's probably not worthwhile.

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