views:

34

answers:

0

After looking to this interesting movie http://channel9.msdn.com/posts/philpenn/Speeding-up-ParallelFor-using-the-Range-Partitioner/ I was wondering how I can change the code below when the collection is a LinkedList not an array:

int size = 300000000;
int[] data = new int[size];

Parallel.ForEach(Partitioner.Create(0, size), (Tuple<int,int> chunk) =>
{
  for (int i = chunk.Item1; i < chunk.Item2; i++)
  {
     data[i]++;
  }
});

Thanks.