For continuous task, for example rendering an animation, would creating short lived threads every frame be a lot slower than creating threads at the start and then pausing them and resuming?
Or will the difference be negligible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That would be a lot slower; threads have a large overhead.
You can use a threadpool to re-use threads and avoid the overhead.
However, it is probably still not worth using threads for such short-lived tasks because the costs of context switches will outweigh the benefits.
Measure it!