Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: map versus for

by TheDamian (Priest)
on Aug 06, 2008 at 00:14 UTC ( #702524=note: print w/replies, xml ) Need Help??

in reply to Re: map versus for
in thread map versus for

...when you use map, most of your looping and list generation is being done in heavily optimized compiled C-code, not in interpreted Perl. So itís usually being done considerably faster.

Alas for the static nature of the printed word.

This assertion used to be true (back when I was first developing PBP in early 2004). I wouldn't have written it if the example I used hadn't confirmed the statement when benchmarked.

But in all the recent versions of Perl I currently have installed (5.8.3, 5.8.8, 5.10.0), a for outdoes the corresponding map on every test I can think to run. Needless to say, PBP edition 2 will be updated to reflect the current behaviours, but that doesn't fix the thousands of existing copies with that overconfident assertion in them. Sigh. One lives and learns.


Replies are listed 'Best First'.
Re^3: map versus for
by dragonchild (Archbishop) on Aug 06, 2008 at 02:17 UTC
    Wouldn't this be because of the improvements made in 5.8 re: more efficient aliasing of the loop variable?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://702524]
[moritz]: seems there's a size limit for hostenum, and the error message just sucks
[vrk]: None, other than the location of the error: auto/NetAddr/IP/
[vrk]: Aha, there's a reference to "bug report 82719" in NetAddr/'s sub _splitref.
[moritz]: wow, that's their idea of an "improved error message"
[moritz]: how about "This network is too large to enumerate all host addresses." or so?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2017-04-25 07:39 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (449 votes). Check out past polls.