Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

RE: RE: RE: RE: My favorite looping mechanism in Perl is:

by btrott (Parson)
on May 15, 2000 at 20:56 UTC ( [id://11678]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: RE: My favorite looping mechanism in Perl is:
in thread My favorite looping mechanism in Perl is:

I believe it is/was wasteful because of the list that map builds to return to you. The normal use of map is like this:
my @returned = map BLOCK LIST;
In order to fill up @returned, map has to build a list. If you're not going to be using that list (if you're using map in void context), you've wasted that storage and the processing time needed to allocate that memory.

However, I've read bits and pieces of this discussion in the past, and I had thought that this list-building was optimized away when map is used in a void context. Is this the case, or was that merely a suggestion? :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11678]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found