|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: map versus forby jbert (Priest) |
| on Aug 05, 2008 at 10:48 UTC ( #702315=note: print w/ replies, xml ) | Need Help?? |
|
You're right. I'm surprised too (not least because map could actually be implemented that way within perl...). I get a lot of variability (perl 5.8.8, x86_64-linux-gnu-thread-multi), but the for loop is a little faster. All the comments about better style still stand, but I would certainly have expected the map to be faster. This is odd. Anyone have a 5.10 to hand to see if anything has changed? Sidenote: is perhaps better written as: my @results = (0..1_000_000); (Of course, given your observation regarding map, whether it performs better is now a whole 'nother ball of wax.)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||