Also, aren't newer versions of perl optimized such that when map is used in a void context, the extra work that differentiates it from foreach and from for optimized away? (Source: http://www.perlmonks.org/index.pl?node_id=296742)
The optimisation relating to map in a void context is that map doesn't build the return list (what would be returned from the map) when it detects it is called in a void context. It doesn't (I think "can't", but I not sure of that), stop the input list being built.
From my testing, the outrageous use of memory only occurs when I am using Threads and Thread::Queue, otherwise the two perform similarly.
Post -- or send me via the mail ID on my home page -- the real code. Then we'll see.
In reply to Re^3: Thread::Queue memory issue with nested maps but not foreach loops...
by BrowserUk
in thread Thread::Queue memory issue with nested maps but not foreach loops...
by jmmitc06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |