It seems like when I invoke map on a parallel list, the operation runs in parallel, but when I do filter on that list, the operation runs strictly sequentially. So to make filter parallel, I first do map to (A,Boolean), then filter those tuples, and map all back again. It feels not very convenient.
So I am interested – which operations on parallel collections are parallelized and which are not?
There are no parallel lists. Calling
paron aListconverts theListinto the default parallel immutable sequence – aParVector. This conversion proceeds sequentially. Both thefilterand themapshould then be parallel.Perhaps you’ve concluded that the
filteris not parallel, because you’ve measured both the conversion time and thefiltertime.Some operations not parallelized currently:
sort*variants,indexOfSlice.