The effect of multi-threading becomes more obvious when the workload is larger. When the volume is small, the time consumption caused by thread creation and switching will be greater than the time saved by parallel computing. Just like 1,000 people building a house is not necessarily faster than 10 people building a house, but 1,000 people building 100 houses will be faster than 10 people.
I suggest you print the time before and after the code block or function that you think is suspicious, so that you can see where the time is spent. Then analyze why it takes time.
The effect of multi-threading becomes more obvious when the workload is larger. When the volume is small, the time consumption caused by thread creation and switching will be greater than the time saved by parallel computing. Just like 1,000 people building a house is not necessarily faster than 10 people building a house, but 1,000 people building 100 houses will be faster than 10 people.
I suggest you print the time before and after the code block or function that you think is suspicious, so that you can see where the time is spent.
Then analyze why it takes time.