Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I came across the MCE::Map utility and wanted to try out.
Here's what I see...
testuser@linux-mint:~$ cat just_map.pl use strict; use warnings; my @biglist = (1..10000000); my @squared_big_list = map { $_ * $_ } @biglist; testuser@linux-mint:~$ time perl just_map.pl real 0m1.743s user 0m1.496s sys 0m0.248s testuser@linux-mint:~$ cat mce_map.pl use strict; use warnings; use MCE::Map; my @biglist = (1..10000000); my @squared_big_list = mce_map { $_ * $_ } @biglist; testuser@linux-mint:~$ time perl mce_map.pl real 0m5.401s user 0m16.008s sys 0m4.658s testuser@linux-mint:~$
Why is the time more with MCE::Map? I tried it with various versions of perl (5.16, 5.24, 5.32 and 5.34) and I get similar results....Either I'm reading something wrong or my understanding is messed up.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: I thought MCE::Map is faster than usual map. What am I missing? (updated)
by LanX (Saint) on May 27, 2021 at 22:29 UTC | |
Re: I thought MCE::Map is faster than usual map. What am I missing?
by Anonymous Monk on May 28, 2021 at 01:01 UTC | |
Re: I thought MCE::Map is faster than usual map. What am I missing?
by perlfan (Vicar) on Jun 02, 2021 at 23:19 UTC |
Back to
Seekers of Perl Wisdom