All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…
Included in the .NET 4 Framework Beta 2 is a more robust and faster version of PLINQ. Between B1 and B2, PLINQ changes have mainly been under the covers, so hopefully no need to rewrite any of your applications to see the improvements.
1. Many improvements to performance and scalability
2. GroupBy and GroupJoin now preserve ordering within the groups
3. Better integration with performance profiling, which now shows PLINQ markers
4. Cancellation consistently works across all PLINQ operators
5. Scoped some of the boundary conditions of PLINQ in .NET 4 in Beta2 of Parallel Extensions as follows:
a. Max Degree of Parallelism changed from 64 to 63
b. Greater consistency regarding maximum input length
i. PLINQ does not support inputs of length > Int32.MaxValue. Queries may throw OverflowException for many operators.
ii. LongCount no longer counts beyond Int32.MaxValue
6. Improved robustness
a. Reliability and concurrency focus
b. More consistent exception handling and error model
7. Other bug fixes
If any of these severely impact your applications, particularly the boundary conditions, please let us know so that we can include that in our planning efforts. For now, we found that it makes the most sense to scope some inputs and give a reliable and predictable experience in this release.
Hi, just found this as I was running into the issue with iterating over an IEnumerable of length greater than Int32.MaxValue.
So what is my solution then if I want to iterate over an IEnumerable greater than this value?
Do I use the earlier version of PLINQ?
@Mark: For enumerables of length greater than Int32.MaxValue, as a workaround you can split the enumerable into multiple chunks and process those chunks with PLINQ. For example, if you wrote an extension method like:
public static IEnumerable<IEnumerable<T>> Batch<T>(this IEnumerable<T> source, int batchSize);
then instead of writing a query like:
return data.AsParallel.Select(el => Process(el));
you could write:
return data.Batch(500000000).SelectMany(batch => batch.AsParallel.Select(el => Process(el)));
I hope that helps.