concurrent run time problem
-
Hi everyone,
İ created 8 threads using qtconcurrent run. Everything seems okey, threads are working parallely but there is not time improvement. Single call to function lasts about 80 msec but 8 thread lasts around 900 msecs.
There are no global variables etc used. In thread function, there are lots of for loops, big array operations (array sizes are around250000 byte). What can be the problem..
regards -
QtConcurrent::run does not create 8 threads. It puts 8 tasks in a queue to be run in parallel. Underlying this is a thread pool which correlates with the number of cores. If you have only 4 (logical) cores, only 4 threads will run in parallel.
Two general problems immediately come to mind. 1) You are using the future and wait for the result immediately after each call of QtConcurrent::run. 2) You are doing some synchronization, e.g. using mutexes. If you want help, you need to show your code.
-
You can see the following youtube Videos which is related to Qt Concurrent Moudle And Qt Threading Functionality.
https://www.youtube.com/playlist?list=PLh0cogPqXcJN-VKY6M6beid92rBHgIN1u