From a481908232ef20449e6ad6951769677e0b108ca8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 31 May 2017 15:24:09 +0200 Subject: Task scheduler: Optimize subsequent pushing bunch of tasks The idea is to accumulate all new tasks in a thread local queue first without doing any thread synchronization (aka, locks and conditional variables) and move those tasks to a scheduler queue once they are all ready. This way we avoid per-task-pool lock and only have one lock per bunch of tasks. This is particularly handy when scheduling new dependency graph node children. Brings FPS of cached simulation from the linked below file from ~30 to ~50. See documentation for BLI_task_pool_delayed_push_{begin, end} and for TaskThreadLocalStorage::do_delayed_push. Fixes T50027: Rigidbody playback and simulation performance regression with new depsgraph Thanks Bastien for the review! --- source/blender/depsgraph/intern/eval/deg_eval.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/depsgraph/intern') diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index e739bc9dbb5..54947ddbb5e 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -126,7 +126,9 @@ static void deg_task_run_func(TaskPool *pool, #endif } + BLI_task_pool_delayed_push_begin(pool, thread_id); schedule_children(pool, state->graph, node, state->layers, thread_id); + BLI_task_pool_delayed_push_end(pool, thread_id); } typedef struct CalculatePengindData { -- cgit v1.2.3