parallel icon indicating copy to clipboard operation
parallel copied to clipboard

Chunk better

Open treeowl opened this issue 7 years ago • 3 comments
trafficstars

parListChunk previously split a list up into chunks, applied the given strategy to each chunk, and then put them all together again. This led to two extra copies of the list.

We get very little benefit from actually splitting the list, because the parallel computations need to traverse their part anyway; we can instead just hand off the whole list and let them count out their chunk. We count each chunk twice, but that shouldn't cost enough to matter.

Now that Eval has a MonadFix instance, we can avoid actually having to put together lists at the end; instead, we pass each parallel computation the (as-yet-uncomputed) result of calculating the rest of the list.

treeowl avatar Jun 21 '18 17:06 treeowl

Great. Can we have some tests and benchmarks please?

simonmar avatar Jun 21 '18 18:06 simonmar