On Sun, May 27, 2012 at 2:52 AM, Cedric Greevey <cgree...@gmail.com> wrote: > I noticed with the working pdoseq I posted earlier that sometimes the > threads on one core get ahead of those on the others, for some reason, > and then that core is idle for the rest of a job -- Windows, at least, > doesn't seem to reassign one or more threads to the freed core. So I > wrote this version: > > (defmacro pdoseq > "Bindings as for for, but parallel execution as per pmap, pcalls, > pvalues; returns > nil." > [seq-exprs & body] > `(let [procs# (+ 2 (.availableProcessors (Runtime/getRuntime))) > calls# (for ~seq-exprs (fn [] ~@body)) > chunks# (atom [nil (partition 100 calls#)])
Eh. For general use, that needs to be (partition 100 100 nil calls#) in case the total size of the job isn't divisible by 100; otherwise, the items after the last exact multiple of 100 will be silently not done. -- 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