Guy Steele on Functional Code for Parallel Execution (2009) [video]
vimeo.com
vimeo.com
It makes sense to use divide-and-conquer rather than a first-rest pattern when doing parallel computations on sequences. But I'm curious if that pattern can be applied to other data structures as well and not just tree structures like the conc list?
For instance, to compute a count of words, the former word collection can be either a conc tree in memory or a file divided in chunks or a bunch of files. In each case, the sub counts can be computed independently and reconciled into a total count.
The deep insight Guy Steele provides in his talk, is how to deal with the non trivial cases like the count of words in a file divided in chunks where words can cross chunk boundaries.
Hence, I highly recommend watching this talk. As further reading, I recommend too a post [1] that I written after having watched Guy Steele talk. [2] is a work in progress to implement the idea in OCaml.
[1] http://acidalie.free.fr/unfoldvalue/blog/map-reduce-spirit.h...
But this complexity is mitigated by the fact that these associative combiners can be built incrementally using a reduced set of patterns, combiner compositions and transformations.
Have a look to this remarkably well written post [1] on incremental regular expressions (it appears that incremental computation is deeply related with parallel computation). It shows well, on a non-trivial example, how to build such an intermediate data representation with its associative combiner.
> This Talk Is about Performance > > The bag of programming tricks that has served us so well for the last 50 years is the wrong way to think going forward and must be thrown out.
That said, I highly recommend watching this talk. I think the most insights regarding cons v. conc lists are worth thinking about.