is way faster than:perl -MTime::HiRes=time -wE"my $t=time; my @a=1..1e6;say time-$t;
because the map generates an anon array that is an "extra step" and that array is copied to @a.perl -MTime::HiRes=time -wE"my $t=time; my @a=map $_,1..1e6;say time-$ ++t;
In your later code, you have a map within a map which is similar to a foreach within a foreach. So it is going to run like 1 million times slower.
On my machine...
C:\Projects>perl -MTime::HiRes=time -wE"my $t=time; my @a=(1..1e6);say + time-$t;" 0.0974979400634766 C:\Projects>perl -MTime::HiRes=time -wE"my $t=time; my @a=map $_,1..1e +6;say time-$t;" 0.337559938430786 C:\Projects>perl -MTime::HiRes=time -wE"my $t=time; my @a=map {$_}1..1 +e6;say time-$t;" 0.339046001434326
In reply to Re: What could cause excessive page faults?
by Marshall
in thread What could cause excessive page faults?
by BrowserUk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |