diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-08 12:34:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-08 17:06:46 +0300 |
commit | 054ab92f8b2caa795162765dee08f749563994c7 (patch) | |
tree | bc0ac81544fe147ea9f59d63ee73b2dfeebc2c2e /source/blender/depsgraph/intern/eval/deg_eval.cc | |
parent | abc36cad833943c0629238bb5a62aaa4ba5679ad (diff) |
Depsgraph: Avoid threading for trivial operations
Found this while looking into T70463, solves the high spinning times
mentioned in T70463#791026.
Sounds logical that iterating over an array to modify a single property
is faster than doing it in threads. But strangely, doing it for both
nodes and its components is still faster in threads here.
Gives extra speedup with a file mentioned in the report.
Reviewed By: brecht, mont29
Differential Revision: https://developer.blender.org/D6017
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 0622fdcc5a9..61dd461cfde 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -91,10 +91,6 @@ static void deg_task_run_func(TaskPool *pool, void *taskdata, int thread_id) BLI_task_pool_delayed_push_end(pool, thread_id); } -struct CalculatePendingData { - Depsgraph *graph; -}; - static bool check_operation_node_visible(OperationNode *op_node) { const ComponentNode *comp_node = op_node->owner; @@ -106,13 +102,8 @@ static bool check_operation_node_visible(OperationNode *op_node) return comp_node->affects_directly_visible; } -static void calculate_pending_func(void *__restrict data_v, - const int i, - const TaskParallelTLS *__restrict /*tls*/) +static void calculate_pending_parents_for_node(OperationNode *node) { - CalculatePendingData *data = (CalculatePendingData *)data_v; - Depsgraph *graph = data->graph; - OperationNode *node = graph->operations[i]; /* Update counters, applies for both visible and invisible IDs. */ node->num_links_pending = 0; node->scheduled = false; @@ -145,13 +136,9 @@ static void calculate_pending_func(void *__restrict data_v, static void calculate_pending_parents(Depsgraph *graph) { - const int num_operations = graph->operations.size(); - CalculatePendingData data; - data.graph = graph; - TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); - settings.min_iter_per_thread = 1024; - BLI_task_parallel_range(0, num_operations, &data, calculate_pending_func, &settings); + for (OperationNode *node : graph->operations) { + calculate_pending_parents_for_node(node); + } } static void initialize_execution(DepsgraphEvalState *state, Depsgraph *graph) |