T
tuser
I am reading Damian Conways "Perl Best Practices", in chapter 8
(Built-in Functions), paragraph "reversing lists", he discusses coding
a down-iterating for loop:
I quote from the book
===========================
===========================
I understand the benefits of the second loop and Damian states that the
difference in iteration speed is usually not even noticable.
But I can't find any statement about memory efficiency, so my question
is this:
In the second for-loop (the one with the reverse-function):
would the entire list ($MIN..$MAX) be constructed first, then reversed
and iterated over ?
....or...
is there some optimizer which internally would translate the for-loop
into a memory efficient for (my $remaining=$MAX; $remaining>=$MIN;
$remaining--) ?
(Built-in Functions), paragraph "reversing lists", he discusses coding
a down-iterating for loop:
I quote from the book
===========================
........
===========================
I understand the benefits of the second loop and Damian states that the
difference in iteration speed is usually not even noticable.
But I can't find any statement about memory efficiency, so my question
is this:
In the second for-loop (the one with the reverse-function):
would the entire list ($MIN..$MAX) be constructed first, then reversed
and iterated over ?
....or...
is there some optimizer which internally would translate the for-loop
into a memory efficient for (my $remaining=$MAX; $remaining>=$MIN;
$remaining--) ?