At first, I suggested that each collection class receive an additional method parthat converts the collection into a suitable parallel data structure (for example, mapreturns the best collection for an item type in Scala 2.8).
Now it seems that some collection classes support methods par(for example, the Array), but others have methods toParSeq, toParIterable(eg, a list). This is a bit strange, as the array is not used or is not recommended often.
What is the reason for this? Wouldn't it be better to have parcollections for all classes that do the “right thing”?
If I have data that can be processed in parallel, what types should I use? Features in scala.collectionor type of implementation directly?
Or am I better Arraysnow because they seem to be cheaper to parallelize?
source
share