title: Parallel reduce algorithm implementation
body: <p>I've been investigating implementations of reduce [inject, fold, whatever you want to call it] functions in Objective-C using blocks and was wondering if there were any techniques for parallelizing the computation where the function applied is <strong><em>associative</em></strong> (e.g. sum of a collection of integers)?</p>
  
  <p>i.e. is it possible to parallelize or improve on something like this on NSArray:</p>
  
  <pre><code>- (id)reduceWithBlock:(id (^)(id memo, id obj))block andAccumulator:(id)accumulator
  {
    id acc = [[accumulator copy] autorelease];
  
    for (id obj in self) {
      acc = block(acc, obj);
    }
    return acc;
  }
  </code></pre>
  
  <p>Using grand-central dispatch?</p>
  
  <p>EDIT: I've made a second attempt, partitioning the array into smaller chunks and reducing them in separate dispatch queues but there's no discernable performance gain in my testing: <a href="https://gist.github.com/1099122" rel="nofollow">(gist here)</a></p>