Quantcast
Viewing latest article 9
Browse Latest Browse All 22

Selecting appropriate partitioning strategy in Task Parallel Library- Part I

When you supply any data to a parallel loop in Task Parallel Library (TPL), it is automatically broken into partitions and these partitions are allocated to tasks. Otherwise if loops were to pick each item individually, the synchronization required to avoid the same item being picked by multiple items would have overweighed the gains of parallelism. The role of a partitioner is to break the data source into partitions. We have a number ways of doing this partitioning, and the way it is done can have an impact on the performance of the parallel loop. The default partitioner offers good performance but you can design your own partitioning strategy that suits your needs or the data source. Here in this blog I’m going to show you how the default partitioner in Task Parallel Library works and how you can improve the performance for small loop bodies using chunking. In part [&hellip

Viewing latest article 9
Browse Latest Browse All 22

Trending Articles