static_partitioner Class


Specify that a parallel algorithm should distribute the work uniformly across threads and should not do additional load balancing.


#include "tbb/partitioner.h"


class static_partitioner;


An algorithm with a static_partitioner distributes the range across threads in subranges of approximately equal size. The number of subranges is equal to the number of threads that can possibly participate in task execution, as specified by task_scheduler_init and task_arena classes. These subranges are not further split.


static_partitioner reduces overheads for parallel algorithms where the work is originally well-balanced. However, it also limits available parallelism, and in case of work imbalance may result in performance loss.


The regularity of subrange sizes is not guaranteed if the range type does not support proportional splitting, or if the grain size is set larger than the size of the range divided by the number of threads participating in task execution.

In addition, static_partitioner uses a deterministic task affinity pattern to hint the task scheduler how the subranges should be assigned to threads. It might therefore improve cache locality similarly to affinity_partitioner.


Use of static_partitioner is recommended for:

  • Parallelizing small well-balanced workloads where enabling additional load balancing opportunities would bring more overhead than performance benefits.
  • Porting OpenMP* parallel loops with schedule(static) if deterministic work partitioning across threads is important.


namespace tbb {
    class static_partitioner {
The following table provides additional information on the members of this class.
Member Description

Construct a static_partitioner.


Destroy this static_partitioner.

For more complete information about compiler optimizations, see our Optimization Notice.