Skip to content

Commit e66144f

Browse files
authored
Merge pull request #10567 from Calinou/using-multiple-threads-slow-reword
Reword warning about slow thread creation in Using multiple threads
2 parents 3a42447 + ff84bad commit e66144f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tutorials/performance/using_multiple_threads.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,17 @@ wait until the thread is done (if not done yet), then properly dispose of it.
141141

142142
.. warning::
143143

144-
Creating threads at runtime is slow on Windows and should be avoided to
145-
prevent stuttering. Semaphores, explained later on this page, should be used
146-
instead.
144+
Creating threads is a slow operation, especially on Windows. To avoid
145+
unnecessary performance overhead, make sure to create threads before heavy
146+
processing is needed instead of creating threads just-in-time.
147+
148+
For example, if you need multiple threads during gameplay, you can create
149+
threads while the level is loading and only actually start processing with
150+
them later on.
151+
152+
Additionally, locking and unlocking of mutexes can also be an expensive
153+
operation. Locking should be done carefully; avoid locking too often (or for
154+
too long).
147155

148156
Mutexes
149157
-------

0 commit comments

Comments
 (0)