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:
authorBastien Montagne <montagne29@wanadoo.fr>2016-12-23 14:40:47 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-03-03 19:42:33 +0300
commitfe226dc5b3a934d684528b67a3befb3630da4c0b (patch)
tree05895513f16e49d35511e09bfc4d59b3871f6b11
parent9dab894e641d5190a26c6fafb918d9503cc76f3b (diff)
Do less nanosleep loops.unlock_task_scheduler
tested that already without much change yesterday, but for some reasons today it gives me another 2-3% speedup in both test files. And it should also mitigate the (supposed) almost-starving situation, hopefully.
-rw-r--r--source/blender/blenlib/BLI_task.h2
-rw-r--r--source/blender/blenlib/intern/task.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index d27bf4dad20..a551124375e 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -97,7 +97,7 @@ void BLI_task_pool_work_and_wait(TaskPool *pool);
void BLI_task_pool_cancel(TaskPool *pool);
/* set number of threads allowed to be used by this pool */
-void BLI_pool_set_num_threads(TaskPool *pool, int num_threads);
+void BLI_pool_set_num_threads(TaskPool *pool, size_t num_threads);
/* for worker threads, test if canceled */
bool BLI_task_pool_canceled(TaskPool *pool);
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index e53327640fb..f3ad071b884 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -49,7 +49,7 @@
#define MEMPOOL_SIZE 256
/* Parameters controlling how much we spin in nanosleeps before switching to real condition-controlled sleeping. */
-#define NANOSLEEP_MAX_SPINNING 1000 /* Number of failed attempt to get a task before going to condition waiting. */
+#define NANOSLEEP_MAX_SPINNING 200 /* Number of failed attempt to get a task before going to condition waiting. */
#define NANOSLEEP_DURATION (const struct timespec[]){{0, 200L}} /* Nanosleep duration (in nano-seconds). */
typedef struct Task {
@@ -743,7 +743,7 @@ void BLI_task_pool_work_and_wait(TaskPool *pool)
}
}
-void BLI_pool_set_num_threads(TaskPool *pool, size_t num_threads_max)
+void BLI_pool_set_num_threads(TaskPool *pool, size_t num_threads)
{
/* NOTE: Don't try to modify threads while tasks are running! */
pool->num_threads = num_threads;