.NET 4 Parallel Programming, Not So Fast… (Part 2)

by Shelby Robertson 6. December 2009 20:11

A reader commented on my parallel programming post that the locks I used in my code were the cause of the slow performance I observed. With my implementation the locks are necessary or there is a possibility the code with fail, and it does quite often. I have done some research and it appears the optimal way to increase performance is to use one of the new System.Collections.Concurrent collections. The concurrent collections are designed to work in a multi-threaded environment when collections are going to be accessed concurrently with a minimal amount of locks. I am going to modify the existing code to use a ConcurrentBag<T> collection and will post the updated results here tomorrow.

Tags: , , , ,

.NET 4.0 | Code | LINQ | Parallel

Recent comments

Comment RSS

Posts by month