BLI_bvhtree_overlap does not work multithreaded

`BLI_task_parallel_range` counts the number of tasks depending on the
number of items.

In the case of `BLI_bvhtree_overlap` the number of items is always
between 2 and 16, which makes it always run in single thread.

So, set the maximum number of items per thread to 1.

In my tests the cloth collision system (which calls that function)
went from 0.80fps to 0.88fps.

Differential Revision: https://developer.blender.org/D6523
This commit is contained in:
2020-01-04 08:36:47 -03:00
parent 8314e20139
commit 0ac41dea7e

View File

@@ -1344,6 +1344,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(
if (use_threading) {
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.min_iter_per_thread = 1;
BLI_task_parallel_range(0,
root_node_len,
data,