On Jun 4, 2014, at 1:20 PM, Gary Johnson <gwjoh...@uvm.edu> wrote:

> - If I operate on a vector with a sequence of r/map and r/filter operations 
> and finally with "into []" to get back a vector, then I think that fold will 
> be called within the call to into, and that parallelism should happen 
> there... right? But if that's right, how do I control the group size that the 
> call to fold uses in this case? I see how to specify the group size for a 
> direct call to fold, but not for other function in the library. 
> 
> 
> No, fold will not be called in into. The definition of into uses reduce, 
> which is single-threaded. What you want is one of the following two 
> formulations:
> 
>   (fold group-size cat append! foldable-collection)   ;; if you want to 
> specify the group size
> 
>   (foldcat foldable-collection)  ;; if you are happy with the default 512 
> group size
> 
> In both cases, the foldable-collection is just one of your (r/map f (r/filter 
> p? initial-collection)) forms. For it to be foldable though, 
> initial-collection needs to be a vector, map, or set (i.e., a tree-like 
> collection).
> 
> I hope that helps.

Definitely helpful. With the fold version, and messing with the group size, I'm 
seeing much higher multicore utilization and I think I'm seeing speedups too 
(although it's a little hard to measure because of randomness). I'm also having 
new problems (pauses that get worse over time... GC?) but I'll experiment more 
before I bother anyone else with those.

Thanks so much Gary,

 -Lee

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to