Perl: the Markov chain saw | |
PerlMonks |
Re: Thread::Queue memory issue with nested maps but not foreach loops...by BrowserUk (Patriarch) |
on Mar 03, 2012 at 04:08 UTC ( [id://957594]=note: print w/replies, xml ) | Need Help?? |
I would like to know why the nested maps produces the behavior? First. Take threads and Thread::Queue out of the equation. They are innocent bystanders in the issue. Using nested maps, this require 49MB and 11.4 seconds of cpu time to complete:
Whereas, this using nested for loops requires just 2 1/2 MB and 0.014 seconds of cpu:
For why,
(*)for will also build a list in some circumstances, but far less frequently. It pays to know (some of) the internal details of your language. (As an aside, filling Thread::Queues will huge numbers of items costs big in terms of memory and runtime. Better to limit how much you push into them at one time). With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|