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:
authorLukas Tönne <lukas.toenne@gmail.com>2016-04-28 13:00:51 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-04-28 13:03:26 +0300
commitaaf5ee73f0d987940aa95e6fb603e2045d2fea2b (patch)
tree038c1bef1b945d045e05900b9d5ac1f3c37e9daf
parent8a379e3460048906306042145052d5d7f3bb859c (diff)
Fix for O(N^2) runtime tagging in the new depsgraph.
Some of the tagging functions would be called for every operation, and then in turn tag their ID nodes with all their operations again. With extensive rigs we get ID nodes with a lot (10,000+) operation nodes, which leads to millions of unnecessary tagging calls.
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc26
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc7
2 files changed, 18 insertions, 15 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index a62b23bde68..877ce6e52e9 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -244,17 +244,21 @@ static void deg_graph_build_finalize(Depsgraph *graph)
id_node->layers |= id_to->layers;
}
}
-
- /* Re-tag ID for update if it was tagged before the relations
- * update tag.
- */
- ID *id = id_node->id;
- if (id->tag & LIB_TAG_ID_RECALC_ALL &&
- id->tag & LIB_TAG_DOIT)
- {
- id_node->tag_update(graph);
- id->tag &= ~LIB_TAG_DOIT;
- }
+ }
+ }
+
+ /* Re-tag IDs for update if it was tagged before the relations update tag. */
+ for (Depsgraph::IDNodeMap::const_iterator it = graph->id_hash.begin();
+ it != graph->id_hash.end();
+ ++it)
+ {
+ IDDepsNode *id_node = it->second;
+ ID *id = id_node->id;
+ if (id->tag & LIB_TAG_ID_RECALC_ALL &&
+ id->tag & LIB_TAG_DOIT)
+ {
+ id_node->tag_update(graph);
+ id->tag &= ~LIB_TAG_DOIT;
}
}
}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 486526ed46c..7c660caa2f9 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -436,12 +436,11 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
* This is mainly needed on file load only, after that updates of invisible objects
* will be stored in the pending list.
*/
- for (Depsgraph::OperationNodes::const_iterator it = graph->operations.begin();
- it != graph->operations.end();
+ for (Depsgraph::IDNodeMap::const_iterator it = graph->id_hash.begin();
+ it != graph->id_hash.end();
++it)
{
- OperationDepsNode *node = *it;
- IDDepsNode *id_node = node->owner->owner;
+ IDDepsNode *id_node = it->second;
ID *id = id_node->id;
if ((id->tag & LIB_TAG_ID_RECALC_ALL) != 0 ||
(id_node->layers & scene->lay_updated) == 0)