Thanks all,

microbenchmarking shows that a simple

(time (doseq [[a b] (map vector list-a list-b)]))

is ~50% faster on my system than

(def par-doseq-fn (comp dorun map))

(defmacro par-doseq [bindings & body]
    (let [bindings (partition 2 bindings)]
      `(par-doseq-fn (fn ~(vec (map first bindings))
               ~...@body)
             ~@(map second bindings))))

(time (par-doseq [a list-a b list-b] (+ a b)))

I used these lists:
(def list-a (repeat 400000 1234))
(def list-b (repeat 400000 2345))


On Mar 25, 1:22 am, Phlex <ph...@telenet.be> wrote:
> >> (defn par-doseq-fn [fn&   seqs]
> >>      (loop [rests seqs]
> >>        (when (every? identity (map seq rests))
> >>          (apply fn (map first rests))
> >>          (recur (map rest rests)))))
>
> > It should of course be like this :
>
> > (defn par-doseq-fn [fn&  seqs]
> >     (loop [rests seqs]
> >       (when (every? seq rests)
> >         (apply fn (map first rests))
> >         (recur (map rest rests))))
>
> which amounts to
> (def par-doseq-fn (comp dorun map))
>
> Though there is some consing going on as a result of the map...
>
> Ok that's it, enough of me flooding the mailing list =P
>
> Sacha
--~--~---------~--~----~------------~-------~--~----~
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