How many parallels to use?
-
First of all, I call them "parallels" as this applies to forks, threads, spawns, and even to async code.
-
Overhead of creating new parallel.
-
Overhead of communication (sending job input to parallel, receiving results).
-
Total number of items to process.
-
Time it takes to process an item.
-
Distribution of processing times. (e.g. one long and many short jobs.)
-
Number of cores (CPUs).