ISAI student has asked for the wisdom of the Perl Monks concerning the following question:
I am asking this performance and memory footprint-wise. While I can experiment on my own, I'd rather have an analytical answer rather than empiric
The Two packs of code do the same action. Should there be any perforance gap (memory and/or execution time) chunk 1:
chunk 2:my @lines=foo('bar'); foreach my $line (@lines) { $a.=chomp $line ; $b*= getVa($line);# a parsing function }
Assume that @lines is not used anywhere else in the scope of code. I would assume that memory footprintwise, 2nd chunk should be no larger than chunk 1, unless the garbage collection does not work in the wasy I expect it to. I am not sure how should the performance scale. Thanksforeach my $line ( foo('bar') ) { $a.=chomp $line ; $b*= getVa($line);#a parsing function }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using function output ananymous array vs. named array in foreach
by BrowserUk (Patriarch) on Dec 26, 2012 at 11:48 UTC | |
by Marshall (Canon) on Dec 26, 2012 at 15:48 UTC | |
by BrowserUk (Patriarch) on Dec 26, 2012 at 17:18 UTC | |
by Marshall (Canon) on Dec 27, 2012 at 02:38 UTC | |
by ISAI student (Scribe) on Dec 27, 2012 at 09:03 UTC | |
by BrowserUk (Patriarch) on Dec 27, 2012 at 09:54 UTC | |
|
Re: using function output ananymous array vs. named array in foreach
by Anonymous Monk on Dec 26, 2012 at 11:12 UTC |