Depsgraph: Remove unused priority calculator
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 20 Dec 2017 14:51:59 +0000 (15:51 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 20 Dec 2017 14:53:39 +0000 (15:53 +0100)
While it sounds useful, in practice it was rather causing
extra overhead and was slowing things down.

source/blender/depsgraph/intern/eval/deg_eval.cc

index 6a1032669bc2a798a9741056a41d976da5d60a79..0f6fa2897bab8c685f18d58e1c6147309bf8bf00 100644 (file)
@@ -55,9 +55,6 @@ extern "C" {
 #include "intern/depsgraph_intern.h"
 #include "util/deg_util_foreach.h"
 
-/* Unfinished and unused, and takes quite some pre-processing time. */
-#undef USE_EVAL_PRIORITY
-
 namespace DEG {
 
 /* ********************** */
@@ -161,33 +158,6 @@ static void calculate_pending_parents(Depsgraph *graph, unsigned int layers)
                                do_threads);
 }
 
-#ifdef USE_EVAL_PRIORITY
-static void calculate_eval_priority(OperationDepsNode *node)
-{
-       if (node->done) {
-               return;
-       }
-       node->done = 1;
-
-       if (node->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
-               /* XXX standard cost of a node, could be estimated somewhat later on */
-               const float cost = 1.0f;
-               /* NOOP nodes have no cost */
-               node->eval_priority = node->is_noop() ? cost : 0.0f;
-
-               foreach (DepsRelation *rel, node->outlinks) {
-                       OperationDepsNode *to = (OperationDepsNode *)rel->to;
-                       BLI_assert(to->type == DEG_NODE_TYPE_OPERATION);
-                       calculate_eval_priority(to);
-                       node->eval_priority += to->eval_priority;
-               }
-       }
-       else {
-               node->eval_priority = 0.0f;
-       }
-}
-#endif
-
 /* Schedule a node if it needs evaluation.
  *   dec_parents: Decrement pending parents count, true when child nodes are
  *                scheduled after a task has been completed.
@@ -314,13 +284,6 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
                node->done = 0;
        }
 
-       /* Calculate priority for operation nodes. */
-#ifdef USE_EVAL_PRIORITY
-       foreach (OperationDepsNode *node, graph->operations) {
-               calculate_eval_priority(node);
-       }
-#endif
-
        schedule_graph(task_pool, graph, layers);
 
        BLI_task_pool_work_and_wait(task_pool);