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/eval/deg_eval_flush.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/eval/deg_eval_flush.cc')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_flush.cc38
1 files changed, 6 insertions, 32 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index fd5ecec0b5b..96e2974a7ab 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -87,15 +87,6 @@ typedef std::deque<OperationNode *> FlushQueue;
namespace {
-void flush_init_operation_node_func(void *__restrict data_v,
- const int i,
- const TaskParallelTLS *__restrict /*tls*/)
-{
- Depsgraph *graph = (Depsgraph *)data_v;
- OperationNode *node = graph->operations[i];
- node->scheduled = false;
-}
-
void flush_init_id_node_func(void *__restrict data_v,
const int i,
const TaskParallelTLS *__restrict /*tls*/)
@@ -110,13 +101,10 @@ void flush_init_id_node_func(void *__restrict data_v,
BLI_INLINE void flush_prepare(Depsgraph *graph)
{
- {
- const int num_operations = graph->operations.size();
- TaskParallelSettings settings;
- BLI_parallel_range_settings_defaults(&settings);
- settings.min_iter_per_thread = 1024;
- BLI_task_parallel_range(0, num_operations, graph, flush_init_operation_node_func, &settings);
+ for (OperationNode *node : graph->operations) {
+ node->scheduled = false;
}
+
{
const int num_id_nodes = graph->id_nodes.size();
TaskParallelSettings settings;
@@ -395,27 +383,13 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
invalidate_tagged_evaluated_data(graph);
}
-static void graph_clear_operation_func(void *__restrict data_v,
- const int i,
- const TaskParallelTLS *__restrict /*tls*/)
-{
- Depsgraph *graph = (Depsgraph *)data_v;
- OperationNode *node = graph->operations[i];
- /* Clear node's "pending update" settings. */
- node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE |
- DEPSOP_FLAG_USER_MODIFIED);
-}
-
/* Clear tags from all operation nodes. */
void deg_graph_clear_tags(Depsgraph *graph)
{
/* Go over all operation nodes, clearing tags. */
- {
- const int num_operations = graph->operations.size();
- TaskParallelSettings settings;
- BLI_parallel_range_settings_defaults(&settings);
- settings.min_iter_per_thread = 1024;
- BLI_task_parallel_range(0, num_operations, graph, graph_clear_operation_func, &settings);
+ for (OperationNode *node : graph->operations) {
+ node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE |
+ DEPSOP_FLAG_USER_MODIFIED);
}
/* Clear any entry tags which haven't been flushed. */
BLI_gset_clear(graph->entry_tags, NULL);