Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-10-08 12:34:07 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-10-08 17:06:46 +0300
commit054ab92f8b2caa795162765dee08f749563994c7 (patch)
treebc0ac81544fe147ea9f59d63ee73b2dfeebc2c2e /source/blender/depsgraph/intern/depsgraph_tag.cc
parentabc36cad833943c0629238bb5a62aaa4ba5679ad (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/depsgraph_tag.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc34
1 files changed, 10 insertions, 24 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index be1ae633cb6..77b24d60b10 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -809,24 +809,6 @@ static void deg_graph_clear_id_recalc_flags(ID *id)
}
}
-static void deg_graph_clear_id_node_func(void *__restrict data_v,
- const int i,
- const TaskParallelTLS *__restrict /*tls*/)
-{
- /* TODO: we clear original ID recalc flags here, but this may not work
- * correctly when there are multiple depsgraph with others still using
- * the recalc flag. */
- DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(data_v);
- DEG::IDNode *id_node = deg_graph->id_nodes[i];
-
- id_node->is_user_modified = false;
-
- deg_graph_clear_id_recalc_flags(id_node->id_cow);
- if (deg_graph->is_active) {
- deg_graph_clear_id_recalc_flags(id_node->id_orig);
- }
-}
-
void DEG_ids_clear_recalc(Main *UNUSED(bmain), Depsgraph *depsgraph)
{
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
@@ -836,10 +818,14 @@ void DEG_ids_clear_recalc(Main *UNUSED(bmain), Depsgraph *depsgraph)
return;
}
/* Go over all ID nodes nodes, clearing tags. */
- const int num_id_nodes = deg_graph->id_nodes.size();
- TaskParallelSettings settings;
- BLI_parallel_range_settings_defaults(&settings);
- settings.min_iter_per_thread = 1024;
- BLI_task_parallel_range(0, num_id_nodes, deg_graph, deg_graph_clear_id_node_func, &settings);
- memset(deg_graph->id_type_updated, 0, sizeof(deg_graph->id_type_updated));
+ for (DEG::IDNode *id_node : deg_graph->id_nodes) {
+ /* TODO: we clear original ID recalc flags here, but this may not work
+ * correctly when there are multiple depsgraph with others still using
+ * the recalc flag. */
+ id_node->is_user_modified = false;
+ deg_graph_clear_id_recalc_flags(id_node->id_cow);
+ if (deg_graph->is_active) {
+ deg_graph_clear_id_recalc_flags(id_node->id_orig);
+ }
+ }
}