Hello everyone
I encountered some problems when testing using Task.Run <>.The running time of the program when using Task.Run <> is 1764,Unused time is 961,Why is it slower to use Task.Run (),Thanks for any suggestions.
Parallel processing or using task to run something isn’t always faster.
There is overhead needed to divide the task up and send the task to each processor/thread. This time taken is sometimes a lot more than the actual run time it would take to do the task sequentially.
There might be some time savings at 500,000, but the amount of code being run on each processor is so little that it isn’t worth it.
Hi Christopher Ho
I know that multi-threaded allocations take time,But this is too slow.Maybe something is wrong with my code.Anyway, thanks for your suggestions.