2

In case I have a collection of objects that each object's process takes lots of time, what is the difference between EnumerablePartitionerOptions.NoBuffering and not using Partitioner at all?

http://msdn.microsoft.com/en-us/library/system.collections.concurrent.enumerablepartitioneroptions.aspx

EnumerablePartitionerOptions.NoBuffering:

Create a partitioner that takes items from the source enumerable one at a time and does not use intermediate storage that can be accessed more efficiently by multiple threads. This option provides support for low latency (items will be processed as soon as they are available from the source) and provides partial support for dependencies between items (a thread cannot deadlock waiting for an item that the thread itself is responsible for processing).

Thank you.

Update: who is faster? and why?

IEnumerable<int> Numbers1 = Enumerable.Range(1, 100);
Parallel.ForEach(Numbers1, (number1) => VeryExpensiveMethod(number1));
            //
            //
Partitioner<int> Numbers2 = Partitioner.Create(Enumerable.Range(1, 100),   EnumerablePartitionerOptions.NoBuffering);
Parallel.ForEach(Numbers2, (number1) => VeryExpensiveMethod(number1));
Stav Alfi
  • 13,139
  • 23
  • 99
  • 171
  • Using a `Partitioner` for what? Please supply a little context... – spender May 03 '13 at 12:22
  • 1
    In case I have a collection of objects that each object's prosses takes lots of time, what is the deffrence between EnumerablePartitionerOptions.NoBuffering and not using Partitioner at all? – Stav Alfi May 03 '13 at 12:26
  • Are you talking about not using *parallelism* at all? Maybe if you could present two small code samples of the two situations you want compared. – Damien_The_Unbeliever May 03 '13 at 12:33

0 Answers0