Skip to main content

Posts

Showing posts from April, 2013

How to Improve Linq Query Performance by using Parallel/ PLinq

How to Improve Linq Query Performance by using Parallel/ PLinq
I want to highlight the disadvantage first, because if you know the disadvantage you can make a choice if required in your project or not.
Don't use if you have a Single core or dual core CPU's. I found that depending on the complexity of For loop  the CPU performance reaches more than 70-80%  (Not talking about the simple For loop). So if you want to use the parallelism for complex loop make sure you have more than  2 CPU's Parallelization sometimes cause a  PLinq query to run slower than Linq to object equivalent. Basically it said like queries with few data source elements and fast user delegates are reluctant to speed up much.
Parallel Linq is the parallel implementation of Linq. Parallel Linq implementation on loops provide better performance compared to sequential  loop. Parallel Linq also works like Linq queries operate on any in-memory IEnumerale(of T) data source. PLINQ make full use of all processors on t…