in benchmarks/concurrent_vector_benchmark.cpp [500:527]
void parallelImplGrowBy(
size_t growBy,
benchmark::State& state,
ContainerInit containerInit,
ContainerPush containerPush) {
auto values = containerInit();
for (auto UNUSED_VAR : state) {
values.clear();
dispenso::parallel_for(
dispenso::makeChunkedRange(0, kLength, dispenso::ParForChunking::kStatic),
[&values, containerPush, growBy](size_t i, size_t end) {
while (i + growBy <= end) {
containerPush(values, i, i + growBy);
i += growBy;
}
containerPush(values, i, end);
});
}
int64_t sum = 0;
for (auto i : values) {
sum += i;
}
checkIotaSum(values, sum);
}