Open ccknaus opened 2 years ago
@ccknaus I think the reason for the observed performance difference between the sequential and parallel versions of your code lies in the overhead associated with using parallel processing for relatively simple operations like multiplication. This overhead includes the time required to set up parallel processing, distribute tasks to worker threads, and potentially transfer data between the main thread and worker threads.
In the case of straightforward operations such as multiplying numbers, this overhead can actually be harmful, outweighing any potential performance benefits that parallelism might offer. Consequently, the sequential algorithm tends to be faster in scenarios where individual tasks are simple, like multiplication.
Good evening.
I tried to compare a simple sequencial vs. parallel algorithm. To my surprise, the sequiencial code seems to be faster with different maxWorker options, as well as number of ELEMENTS. My tests are not only restricted for this simple example, but for every comparision of different functions as well.
What am I doing wrong? What is the cause of the higher latency in the parallel map? can I increase the speed?