diff options
author | Iliay Katueshenock <Moder> | 2022-07-26 12:06:49 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-26 12:10:16 +0300 |
commit | c94ca54cdafdba15d5a7be55e81d6f7a0da7ed7e (patch) | |
tree | fe6644d41f65b4e1d5861c33b465b6371b49306c /source/blender/editors/sculpt_paint/curves_sculpt_density.cc | |
parent | 203e7ba3320e7ed978ec094efa0c1b22137fb12a (diff) |
BLI: add use_threading parameter to parallel_invoke
`parallel_invoke` allows executing functions on separate threads.
However, creating tasks in tbb has a measurable amount of overhead.
Therefore, it can be benefitial to disable parallelization when
the amount of work done per function is small.
See D15539 for some benchmark results.
Differential Revision: https://developer.blender.org/D15539
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_density.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_density.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc index 907c2c29c42..e1ac941eb2b 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc @@ -188,6 +188,7 @@ struct DensityAddOperationExecutor { * curves. */ Array<bool> new_curve_skipped(new_positions_cu.size(), false); threading::parallel_invoke( + 512 < already_added_curves + new_positions_cu.size(), /* Build kdtree from root points created by the current stroke. */ [&]() { for (const int i : IndexRange(already_added_curves)) { @@ -309,6 +310,7 @@ struct DensityAddOperationExecutor { }; threading::parallel_invoke( + 1024 < original_positions.size() + deformed_positions.size(), [&]() { self_->original_curve_roots_kdtree_ = roots_kdtree_from_positions(original_positions); }, |