Hmm, im sorry but this is inconclusive to me. The output of B::Deparse is not necessarily exactly what is happening under the hood (as I said to kanji above). Now you may be correct that perl optimizes for(;;) and while(1) into the same construct, but nothing ive seen posted here shows what that construct is.
BTW a benchmark of while(1) versus for(;;) is as follows:
I agree this suggests they optimize down to the same thing..Benchmark: timing 1000000 iterations of for(;;), while(1)... for(;;): 71 wallclock secs (71.66 usr + 0.00 sys = 71.66 CPU) @ 13 +955.57/s (n=1000000) while(1): 71 wallclock secs (71.67 usr + 0.00 sys = 71.67 CPU) @ 13 +952.45/s (n=1000000) Rate while(1) for(;;) while(1) 13952/s -- -0% for(;;) 13956/s 0% --
:-)
Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.
In reply to Re: Re: Re: Re: Re: Re: infinite loop on while (@array)
by demerphq
in thread infinite loop on while (@array)
by jrasillo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |