Hi everyone,

I'm fairly new to writing services in Clojure, but I recently encountered a 
situation where I wasn't sure whether to use map/pmap. The mapping function 
was approaching the point where pmap might make more sense, but I was often 
editing that mapping function. Moreover, my production environment is, of 
course, a bit different than development. So I wasn't sure which would be 
optimal.

Would anyone else find it useful to have a "generic map" that, after 
recording a few execution times, decides whether to use the parallel or 
single-threaded version of map? I wrote up a v1 
here: https://gist.github.com/karansag/bab7ea1a4613dfd929ea.

The code is actually applicable to any parallel-izable sequence operation 
if you add the operation's parallel dual to "parindex." Excuse all the 
do/println statements.

Anyway, if people think this would be useful I can spin it off into a 
(micro)library. The current API requires you to add a var that creates a 
special "dynamic map" -- e.g., (def dynamic-map (dynamicp map)), but I 
could change that or make it easier to use on the fly. Maybe something like 
(dynamic-select (map ...)), where dynamic-select is a macro that adds that 
var to your namespace and uses it in place of map.

Thanks for the input,
Karan

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to