in reply to I thought MCE::Map is faster than usual map. What am I missing?
from MCE::Map
The time for mce_map below also includes the time for data exchanges between the manager and worker processes.
Please try
my @squared_big_list = mce_map_s { $_ * $_ } 1,10000000;
Even faster is mce_map_s; useful when input data is a range of numbers. Workers generate sequences mathematically among themselves without any interaction from the manager process.
(untested)
to elaborate more on what AnoMonk said here:
$_ * $_ is so fast that even a slight communication overhead counts. The more complex the calculation, the less significant will the communication become.
The relation matters.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|