On 01/24/2013 10:23 PM, Joel wrote:

> // parallel foreach for regular files
> foreach(fn ; taskPool.parallel(files,100)) {

> What is the 100 number for?

It is the work unit size:

  http://dlang.org/phobos/std_parallelism.html#.TaskPool

Quoting:

The number of elements processed per work unit is controlled by the workUnitSize parameter. Smaller work units provide better load balancing, but larger work units avoid the overhead of communicating with other threads frequently to fetch the next work unit. Large work units also avoid false sharing in cases where the range is being modified. The less time a single iteration of the loop takes, the larger workUnitSize should be. For very expensive loop bodies, workUnitSize should be 1. An overload that chooses a default work unit size is also available.

Ali

Reply via email to