On 18/08/12 13:13, Michael Gardner wrote:
If you haven't already, start by eliminating reflection warnings[1].
As for pmap, it's unfortunately useless. You could roll your own using e.g.
Java's thread pools, or you could wait for the new reducers library[2].
Reducers should offer not only useful parallelism, but also better performance
across-the-board compared to clojure's sequence functions (since they don't pay
the performance price of laziness).
[1] http://clojuredocs.org/clojure_core/clojure.core/*warn-on-reflection*
[2]
http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
The only reflection warnings I get are from core.logic and seesaw but
these are used/required in other namespaces...I get not warnings from my
own code apart from a couple of cases where I'm calling Math/abs but
that is easy to fix.
As far as pmap goes, I originally thought of starting a new future for
each starting branch but that is what pmap does essentially, so it
looked very handy at first... I don't see how reducers can help here
because I'm not reducing anything really. actually comparing the scores
of the leaf nodes is not so expensive as it sounds (at least I can't
imagine why it would be). The trick would be to start branching in
parallel wouldn't it? So, let's assume you've got a brand new board.
White moves first and he has 20 potential moves to explore (8x2-pawns +
2x2 knights). There is a lot of work to be done in each branch so
assigning a future to each, sounds reasonable. However if that was
actually happening I should be seeing all 4 cores working non-stop!
I just wish pmap worked!
Jim
--
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