From your code I have seen that you call thread.join after calling thread.start() and inside the same loop.But from here you can see that the idiomatic way is to call thread.join in another loop.
for t in ts: t.join()
is generally the idiomatic way to start a small number of threads. Doing .join means that your main thread waits until the given thread finishes before proceeding in execution. You generally do this after you've started all of the threads.
I have used both ways, and it's strange that the program with idiomatic way of using thread.join() takes more execution time than yours.But maybe it is better in memory consumption which i haven't tested yet.
From your code I have seen that you call thread.join after calling thread.start() and inside the same loop.But from here you can see that the idiomatic way is to call thread.join in another loop.
for t in ts: t.join()is generally the idiomatic way to start a small number of threads. Doing .join means that your main thread waits until the given thread finishes before proceeding in execution. You generally do this after you've started all of the threads.
I have used both ways, and it's strange that the program with idiomatic way of using thread.join() takes more execution time than yours.But maybe it is better in memory consumption which i haven't tested yet.