puppetlabs/puppetdb — pull request #470 by cprice-puppet (2013-03-27 21:31:27+00:00)
Title: Add a `bounded-pmap` function, and use it in the export tool

This commit adds a new namespace called `concurrent`, intended to
contain some utility functions relating to concurrency. (I expect
that in most cases these will simply be thin wrappers around
clojure concurrency functions in combination with structures from
`java.util.concurrent`.)

The first major function in this namespace is `bounded-pmap`, which
is just like clojure's `pmap`, but allows you to pass in an integer
value `max-threads` and prevents concurrent evaluation of more than
`max-threads` items in the resulting sequence.

Also ports the `export` command-line tool over to use `bounded-pmap`,
which improves performance by about 3x and drastically reduces
memory consumption.