If I am reading your example correctly, that pmap is simply being used to iterate over the characters of a line read into a string, then yes, you are using pmap in a very inefficient way. pmap creates a future for every element of the sequence you give it, and that is significantly more computation work (allocating, initializing, and invoking future objects) than your function that simply returns 1 regardless of the value of its argument. pmap is best used for parallelizing function invocations that do significantly more work than that.
I realize your example is probably a practice one intended to try out a map/reduce style of coding, but you would probably get even further speedup by using (count file-handle) in place of your reduce call. Andy On Fri, Jan 13, 2012 at 11:47 AM, tmountain <tinymount...@gmail.com> wrote: > Wow, just by changing pmap to map, the same code runs to completion in > 1 minute 35 seconds. I'm guessing this means that context switching > caused a huge performance penalty in this case since the "work" being > executed was so miniscule? > > -- > 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 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