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.
This commit is contained in:
parent
a15a3952f4
commit
0e80d0893f
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,8 @@ extern "C" {
|
|||
|
||||
ComponentDepsNode::ComponentDepsNode() :
|
||||
entry_operation(NULL),
|
||||
exit_operation(NULL)
|
||||
exit_operation(NULL),
|
||||
flags(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/* ---------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue