PLINQ query and partitioning algorithm persistence


  • 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

    Sunday, February 26, 2012 8:45 PM


All replies