Thanks Mark,

This makes sense and I've substituted your version, although I don't think it 
was really making a difference in this case since creating futures should be 
fast (and that seems to be what the data was showing too).

 -Lee


On Aug 4, 2010, at 1:41 PM, Mark Engelberg wrote:

> I agree that the burn-with-futures code looks not right:
> (defn burn-via-futures [n]
>  (print n " burns via futures: ")
>  (time (doall (pmap deref (map (fn [_] (future (burn)))
>                                                  (range n))))))
> 
> should probably be something like:
> 
> (defn burn-via-futures [n]
>  (print n " burns via futures: ")
>  (time (dorun (map deref (dorun (map (fn [_] (future (burn)))
>                                                  (range n))))))
> 
> Otherwise, your pmap is throttling the creation and execution of the futures. 
>  (It may be that the throttling behavior of the pmap is irrelevant or 
> possibly even helpful in this particular code, but it seems like you really 
> want to test how the system handles 48 futures that are created all at once).

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

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