|
30 | 30 | // The exact meaning of each argument depends on the benchmark, allocator, and size components used. |
31 | 31 | // Refer to the 'argsName()' function in each component to find detailed descriptions of these arguments. |
32 | 32 |
|
| 33 | +template <size_t max_threads = 12> |
33 | 34 | static void multithreaded(benchmark::internal::Benchmark *benchmark) { |
34 | | - benchmark->Threads(12); |
35 | | - benchmark->Threads(8); |
36 | | - benchmark->Threads(4); |
37 | 35 | benchmark->Threads(1); |
| 36 | + benchmark->DenseThreadRange(4, max_threads, 4); |
38 | 37 | } |
39 | 38 |
|
40 | 39 | static void singlethreaded(benchmark::internal::Benchmark *benchmark) { |
@@ -91,14 +90,16 @@ UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, disjoint_pool_fix, |
91 | 90 | pool_allocator<disjoint_pool<os_provider>>); |
92 | 91 | UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, disjoint_pool_fix) |
93 | 92 | ->Apply(&default_multiple_alloc_fix_size) |
94 | | - ->Apply(&multithreaded); |
| 93 | + // Limit benchmarks to 4 threads, as the disjoint pool scales poorly with higher thread counts. |
| 94 | + ->Apply(&multithreaded<4>); |
95 | 95 |
|
96 | 96 | UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, |
97 | 97 | disjoint_pool_uniform, uniform_alloc_size, |
98 | 98 | pool_allocator<disjoint_pool<os_provider>>); |
99 | 99 | UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, disjoint_pool_uniform) |
100 | 100 | ->Apply(&default_multiple_alloc_uniform_size) |
101 | | - ->Apply(&multithreaded); |
| 101 | + // Limit benchmarks to 4 threads, as the disjoint pool scales poorly with higher thread counts. |
| 102 | + ->Apply(&multithreaded<4>); |
102 | 103 |
|
103 | 104 | #ifdef UMF_POOL_JEMALLOC_ENABLED |
104 | 105 | UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark, jemalloc_pool_fix, |
|
0 commit comments