Sunday, February 26, 2012 8:45 PM
Suppose we have a PLINQ query such as the following:
var pquery = data.AsParallel().Select(n => n * n).Select(m => Math.Sqrt(m)).Select(o => o * 2);
It is said that if the data source is an array or has implemented IList<T>, PLINQ uses range partitioning, otherwise uses chunk partitioning for non-comparing operators and strip partitioning for TakeWhile, SkipWhile and the like and hash partitioning for comparing operators.
I'd like to know that if the starting employed strategy is persisted when each query operator executes or not. That is if all the operators are aware that what they received has implemented IList<T> so that they too use range partitioning.
My guess is that the answer is no. Becase each query operator returns a ParallelQuery<T> and ParallelQuery<T> has not implemented IList<T>. So if the data source is an IList<T> only the first operator uses range partitionig and the others use other partitioning strategies.
Thanks for your help
- Edited by Mansoor Omrani Sunday, February 26, 2012 8:46 PM
Tuesday, February 28, 2012 7:51 PMOwnerPLINQ tries not to partition and merge for each operator. It'll typically choose a partitioning scheme based on all of the operators being used, will partition once at the beginning of the query, and will then feed the data through to the operators. For more details, see the slide deck at http://blogs.msdn.com/b/pfxteam/archive/2009/11/01/9916008.aspx, and in particular slide 28.
Wednesday, February 29, 2012 9:45 AMThank you for the reply. Also many thanks for sharing the great presentation.