Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: grep, map vs. foreach performance

by Flexx (Pilgrim)
on Sep 04, 2002 at 14:26 UTC ( [id://195085]=note: print w/replies, xml ) Need Help??


in reply to Re^3: grep, map vs. foreach performance
in thread grep, map vs. foreach performance

> perl -MO=Deparse -e 'while($x++ < 10){}' while ($x++ < 10) { (); }

Now, why is that? Shouldn't that be

for(;$x++ < 10;){}

then? On the contrary actually:

> perl -MO=Deparse -e 'for(;();){}' while (()) { (); }

So, it seems that while is for only for the obvious endless loop, and in other cases for is while (as I had expected...)

However, I am intriqued by the fact that

> perl -MO=Deparse -e 'for($x;$y;$z){()}' for ($x; $y; $z) { (); }

and not

{ $x; while($y) { (); } continue { $z; } }

(at least not on the Perl level of things).

Cool stuff anyway! Thanks a million. I learned a lot from your reply. I flew over the optimizer and Deparse a few times (mostly when searching for other things), but using it that way looks powerful. Got any pointers to good information on it? Is there some "How to wrink the guts out of your script using -MO=Deparse/the Optimizer" somewhere?

So long,
Flexx

(I like the photo on your home node, BTW).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://195085]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found