parListChunk is a parallel Strategy for lists. It evaluates elements in chunks of a chosen size, creating fewer sparks than one-spark-per-element mapping. section 13.4.3
Use it when parallel list evaluation creates too much spark-management overhead:
- Choose a chunk size so each spark performs enough work to justify its creation. section 13.4.3
- Pair parListChunk with rseq; parListChunk already creates the parallel sparks, so rpar would add unnecessary work. section 13.4.3
- Tune the size experimentally: excessive sparks can overflow the spark pool or slow execution through management and garbage-collection costs. section 13.4.3
Adapting a Vector
Because parListChunk operates only on lists, convert the Vector, apply the strategy, and convert back: fmap V.fromList . parListChunk size rseq . V.toList. An image-mapping function can use a chunk size such as ((w * h) `div` 1000), producing roughly 1,000 sparks. section 13.4.3
