Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Re: using map and anonymous subroutinesby flyingmoose (Priest) |
on Apr 20, 2004 at 22:04 UTC ( [id://346815]=note: print w/replies, xml ) | Need Help?? |
We all have to have uses for our overly powerful pentium toaster units, don't we ? :)
No, seriously, thanks for the feedback, though I would hope the case 1 and case2 would have been equivalent, essentially map is going to create an array, and we are saying that assignment for an array is slower than a push, or are we instead saying that the blocks { } are the slowdown? Either way, it seems we can get more granularity from this test to learn more about the internals. Anyhow, this all really matters when dealing with the size of input, usually memory is cheap and in surplus, so you just want speed ... yet not always... As a last note, the bestest fastest is not always the best way, given that readability and maintainability is important. Hence you might have to add blocks later, or maybe blocks add clarity, and definitely the push appears hackish -- if not indicative of a bug somewhere. I wouldn't leave production code using that final push.
In Section
Seekers of Perl Wisdom
|
|