David/Greg,

Ihe IEnumerable is not an issue with Parallel.ForEach. The PFX library will
look for few other interfaces for your object and decide the partitioning
strategy based on that.
There are multiple paritioners that will be picked up based on your source:
Range (used for IList), Chunk (used for IEnumerable - it's slow as it has
to wait for each object to partition), Stripe (optional), Hash (for joins).
http://blogs.msdn.com/b/pfxteam/archive/2007/12/02/6558579.aspx
http://blogs.msdn.com/b/pfxteam/archive/2011/11/11/10235999.aspx

You can write your own custom partitioners if you know how the data is
structured and can optimize the partition allocation.
http://msdn.microsoft.com/en-us/library/dd560853.aspx
http://msdn.microsoft.com/en-us/library/dd997411.aspx






On Tue, Jun 25, 2013 at 3:46 PM, Greg Keogh <g...@mira.net> wrote:

>  1. Don't use IEnumerable and Parallel.ForEach, List<T> is much faster.
>>
>
> I don't have the bigger picture here, but IEnumerable and Parallel.ForEach
> go together like pancakes and ice cream. I'm even getting into the habit
> these days of making public methods that return collections prefer to
> return IEnumerable<T>. This means I have the freedom to consume them in
> parallel processing.
>
> Albahari's book C# in a Nutshell discusses parallel processing in general
> in chapter 23, and the Parallel class in particular over 7 dense pages.
> Richter covers the general subject in chapter 26 with 5 pages on Parallel.
> I'm pretty sure all your issues will be clarified in these pages and
> they're a really good read.
>
> Cheers,
> Greg
>

Reply via email to