From 1255f572c76d989e9acf86d1d6089303406bc72f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 11 Jan 2018 14:47:12 +0100 Subject: Depsgraph: Make eval initialization more friendly for threading Helps in cases of not very complex scenes and lots of system threads available. A bit hard to measure change on it's own, it works best with the upcoming changes and gives measurable improvements. --- source/blender/depsgraph/intern/eval/deg_eval.cc | 3 +-- source/blender/depsgraph/intern/eval/deg_eval_flush.cc | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 76e76b5eb7b..c29a0708cef 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -144,13 +144,12 @@ static void calculate_pending_func( static void calculate_pending_parents(Depsgraph *graph, unsigned int layers) { const int num_operations = graph->operations.size(); - const bool do_threads = (num_operations > 256); CalculatePengindData data; data.graph = graph; data.layers = layers; ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = do_threads; + settings.min_iter_per_thread = 1024; BLI_task_parallel_range(0, num_operations, &data, diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 9e910afea07..daf008ddb7d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -112,7 +112,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph) const int num_operations = graph->operations.size(); ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (num_operations > 256); + settings.min_iter_per_thread = 1024; BLI_task_parallel_range(0, num_operations, graph, flush_init_operation_node_func, @@ -122,7 +122,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph) const int num_id_nodes = graph->id_nodes.size(); ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (num_id_nodes > 256); + settings.min_iter_per_thread = 1024; BLI_task_parallel_range(0, num_id_nodes, graph, flush_init_id_node_func, @@ -311,10 +311,9 @@ void deg_graph_clear_tags(Depsgraph *graph) { /* Go over all operation nodes, clearing tags. */ const int num_operations = graph->operations.size(); - const bool do_threads = num_operations > 256; ParallelRangeSettings settings; BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = do_threads; + settings.min_iter_per_thread = 1024; BLI_task_parallel_range(0, num_operations, graph, graph_clear_func, -- cgit v1.2.3