The biggest problem with pmap I have is ordering, ie. it will process in 
batches of (+ 2 (.. Runtime getRuntime availableProcessors)), and only take 
a new batch when the slowest of the old batch has been evaluated. With 
functions dependent on IO, parallel gains are only a fraction of what they 
could be. I used to solve this by creating my own code to process in 
futures and delays, but when I found the claypoole library, especially it's 
unordered pmap and for, I never had to touch these again.

On Wednesday, April 6, 2016 at 3:11:52 PM UTC+2, Mars0i wrote:
>
> Maybe people forget about pmap <http://clojuredocs.org/clojure.core/pmap>, 
> pcalls <http://clojuredocs.org/clojure.core/pcalls>, and pvalues 
> <http://clojuredocs.org/clojure.core/pvalues> because they're just too 
> easy.
>
> On Tuesday, April 5, 2016 at 8:51:59 PM UTC-5, tbc++ wrote:
>>
>> If it all seems confusing, do not despair, there's two things that will 
>> handle the vast majority of the use cases you may have: 
>>
>> 1) `future` - spawns a thread that runs the body of the future (
>> https://clojuredocs.org/clojure.core/future)
>> 2) `atom` and `swap!` - Used to store data that needs to be shared 
>> between threads and updated concurrently (
>> https://clojuredocs.org/clojure.core/atom) these are built on top of 
>> CAS, which itself is foundation upon which most of concurrent programming 
>> is built. (https://en.wikipedia.org/wiki/Compare-and-swap)
>>
>> Those two primitives alone will handle 90% of the use cases you will run 
>> into as a new clojure developer. The rest of the stuff (agents, thread 
>> pools, refs, vars, cps/core.async) can all come in time, but you will use 
>> them much less often than threads and atoms. So read up on those two and 
>> feel free to come back with any questions you may have. 
>>
>> Timothy
>>
>>
>> On Tue, Apr 5, 2016 at 7:24 PM, Chris White <cwpr...@live.com> wrote:
>>
>>> I was doing some reading of code recently to help me get up to speed 
>>> with Clojure. One of the libraries I randomly came across dealt with 
>>> parallelism and I had a hard time following along with it. To try and wrap 
>>> my head around things I did a quick search and found this article:
>>>
>>>
>>> http://www.thattommyhall.com/2014/02/24/concurrency-and-parallelism-in-clojure/
>>>
>>> I'm not sure how authoritative this is based on my current experience, 
>>> but needless to say I was a bit overwhelmed. That said is there any sort of 
>>> introductory material that list members have used to help get them into how 
>>> Clojure deals with concurrency and parallelism? I also don't mind anything 
>>> that's not specifically using Clojure but will at least help me understand 
>>> the concepts behind how Clojure does it. Thanks again for any and all help!
>>>
>>> - Chris White (@cwgem)
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> “One of the main causes of the fall of the Roman Empire was that–lacking 
>> zero–they had no way to indicate successful termination of their C 
>> programs.”
>> (Robert Firth) 
>>
>

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