[Bf-blender-cvs] [0e80d08] master: New depsgraph: Optimize updates flush

Sergey Sharybin noreply at git.blender.org
Thu Oct 29 10:19:34 CET 2015


Commit: 0e80d0893fac47f04f2a06e6d484bddad87ae5d3
Author: Sergey Sharybin
Date:   Thu Oct 29 14:14:09 2015 +0500
Branches: master
https://developer.blender.org/rB0e80d0893fac47f04f2a06e6d484bddad87ae5d3

New depsgraph: Optimize updates flush

Previously it was possible that same component will be tagged for update
again and again, making update flushing really slow. Now we'll store flag
whether component was fully tagged.

This is still temporary solution because ideally we should just support
partial updates, but that's for the future.

Gives around 10% speedup on file from jpbouza.

===================================================================

M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/depsnode_component.cc
M	source/blender/depsgraph/intern/depsnode_component.h

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 65d75fc..a635cb6 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -284,6 +284,7 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 	{
 		OperationDepsNode *node = *it;
 		node->scheduled = false;
+		node->owner->flags &= ~DEPSCOMP_FULLY_SCHEDULED;
 	}
 
 	FlushQueue queue;
@@ -353,12 +354,16 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 		 * witin a component at least we tag the whole component
 		 * for update.
 		 */
-		for (ComponentDepsNode::OperationMap::iterator it = node->owner->operations.begin();
-		     it != node->owner->operations.end();
-		     ++it)
-		{
-			OperationDepsNode *op = it->second;
-			op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
+		ComponentDepsNode *component = node->owner;
+		if ((component->flags & DEPSCOMP_FULLY_SCHEDULED) == 0) {
+			for (ComponentDepsNode::OperationMap::iterator it = component->operations.begin();
+			     it != node->owner->operations.end();
+			     ++it)
+			{
+				OperationDepsNode *op = it->second;
+				op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
+			}
+			component->flags |= DEPSCOMP_FULLY_SCHEDULED;
 		}
 	}
 }
diff --git a/source/blender/depsgraph/intern/depsnode_component.cc b/source/blender/depsgraph/intern/depsnode_component.cc
index 1d939c6..a47a0d2 100644
--- a/source/blender/depsgraph/intern/depsnode_component.cc
+++ b/source/blender/depsgraph/intern/depsnode_component.cc
@@ -50,7 +50,8 @@ extern "C" {
 
 ComponentDepsNode::ComponentDepsNode() :
     entry_operation(NULL),
-    exit_operation(NULL)
+    exit_operation(NULL),
+    flags(0)
 {
 }
 
diff --git a/source/blender/depsgraph/intern/depsnode_component.h b/source/blender/depsgraph/intern/depsnode_component.h
index e3550bb..7f44c0e 100644
--- a/source/blender/depsgraph/intern/depsnode_component.h
+++ b/source/blender/depsgraph/intern/depsnode_component.h
@@ -46,6 +46,12 @@ struct EvaluationContext;
 struct OperationDepsNode;
 struct BoneComponentDepsNode;
 
+typedef enum eDepsComponent_Flag {
+	/* Temporary flags, meaning all the component's operations has been
+	 * scheduled for update.
+	 */
+	DEPSCOMP_FULLY_SCHEDULED = 1,
+} eDepsComponent_Flag;
 
 /* ID Component - Base type for all components */
 struct ComponentDepsNode : public DepsNode {
@@ -146,6 +152,8 @@ struct ComponentDepsNode : public DepsNode {
 	OperationDepsNode *exit_operation;
 
 	// XXX: a poll() callback to check if component's first node can be started?
+
+	int flags;
 };
 
 /* ---------------------------------------- */




More information about the Bf-blender-cvs mailing list