-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I tried using qmap for 70 work tasks with runtime between 1-100 min. Printing progress once after each task caused really bad performance. I believe print in all but thread 1 caused the thread to wait until thread 1 finished its current task.
Below is an MWE that I would expect to finish in 3 seconds if using more than 1 threads, but for me using 4 threads it takes 15 seconds
using ThreadPools
function do_work(t)
# work for t seconds
t0 = time_ns()
while (time_ns() - t0) * 1e-9 < t
nothing
end
end
function test(n)
qmap(1:n) do i
if Threads.threadid() == 1
do_work(3)
else
println(i)
end
end
nothing
end
@time test(10)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels