in reply to (jeffa) 3Re: Is for(@$array_ref) construct optimized? YES!
in thread Is for(@$array_ref) construct optimized? YES!

Aha! we see a difference between 5.6.0 and 5.6.1 with respect to this:
D:\Perl56\bin>perl -MO=Deparse -we "$x=[];for($i=0;$i<=$#x;$i++){}" $x = []; $i = 0; while ($i <= $#x) { (); } continue { ++$i } -e syntax OK D:\>perl -MO=Deparse -we "$x=[];for($i=0;$i<=$#x;$i++){}" $x = []; for ($i = 0; $i <= $#x; ++$i) { (); } -e syntax OK
Here I tried to compare 5.6.0 (I called it from 5.6.0 dir which is d:\perl56\bin in my computer) and 5.6.1 (it's in my $PATH)

update I did update to call a snippet without compile errors; but explanation of results before and after update are same

Replies are listed 'Best First'.
Re^5: Is for(@$array_ref) construct optimized? YES!
by Aristotle (Chancellor) on Jun 16, 2002 at 21:04 UTC
    It's the B::Deparse version, not the Perl version that matters here.

    Makeshifts last the longest.

      I see, and this unsurprises me: newer B::Deparse understands additional typical constructs and resolves them. Isn't this bad? Don't know. I consider this improvement as not good, because before this day I used B::Deparse as a way to see into internal representation, and now I understand this is not 100% working.

      Thank you for clarifying!

        B::Deparse is supposed to get you what you fed into it, so the fact that it gets closer isn't a bad thing. If you want to see what's really happening, compile perl with -DDEBUGGING and watch the opcode trace some time.
        See my updated initial reply. All that's changed throughout history, as far as I can tell, is what values the various switches default to. It seems to have gone back and forth a couple times as time passed, at least I know old versions of the module used to expose the loop for($what;$it;$is) without extra switches passed.

        Makeshifts last the longest.