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:
authorRay Molenkamp <github@lazydodo.com>2020-06-17 18:26:49 +0300
committerRay Molenkamp <github@lazydodo.com>2020-06-17 18:26:49 +0300
commite590526af6e843cc173beb5ae06ac1d8c5fad471 (patch)
tree3652d08f3a5b876b42f1e8ce1d3e79c369064785 /source/creator/creator.c
parent9bfd78ae146d50f4bf5017a1c3ee7f3dec0c57db (diff)
Fix T76767: Cycles performance regression with CLI renders
When picking a small tile size when doing a CLI render will yield many status updates being printed to the console causing a slowdown in the render process. 2.79 with the same amount of tiles did not have this slowdown. The reason for this turned out to be a debugging aid added in rBd2757d149bf2 which disabled buffering for stdout which on windows caused every single character being printed to the console to try to obtain a mutex, and worse the thread being put to sleep when this mutex was unavailable leading to poor performance. This patch changes the behaviour by only disabling the buffering in debug builds. CLI render of the default cube with 16x16 tiles at 1080p 2.83 : 37.57s now : 17.03s note: this only affected CLI renders, renders from the UI do not report this kind of information and had no such slowdown.
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r--source/creator/creator.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c
index ea64184c826..b96b33f7a27 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -248,8 +248,12 @@ int main(int argc,
/* Unbuffered stdout makes stdout and stderr better synchronized, and helps
* when stepping through code in a debugger (prints are immediately
- * visible). */
+ * visible). However disabling buffering causes lock contention on windows
+ * see T76767 for detais, since this is a debugging aid, we do not enable
+ * the unbuffered behavior for release builds. */
+#ifndef NDEBUG
setvbuf(stdout, NULL, _IONBF, 0);
+#endif
#ifdef WIN32
/* We delay loading of openmp so we can set the policy here. */