Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

RE: The Best Infinite Loop

by indigo (Scribe)
on Oct 17, 2000 at 06:01 UTC ( #37079=note: print w/replies, xml ) Need Help??


in reply to The Best Infinite Loop

Seems odd, that Perl would supply special while () syntax (while with nothing in the parens), and not make it at least as fast other other comman idioms. Try benchmarking that.

Replies are listed 'Best First'.
(zdog) RE: (2) The Best Infinite Loop
by zdog (Priest) on Oct 18, 2000 at 01:51 UTC
    I never realized that while() could be used as an infinite loop, so I went and benchmarked it up against for (;;) and I got these results:
    Benchmark: timing 20000 iterations of for, while()... for: 45 wallclock secs (43.95 usr + 0.00 sys = 43.95 CPU) @ 45 +5.06/s (n=20000) while(): 43 wallclock secs (43.28 usr + 0.00 sys = 43.28 CPU) @ 46 +2.11/s (n=20000)

    Note: Do not be alarmed if it took longer this time than in the above post, I did it on a slower computer.

    Sooo..., I guess you were right!!

    Zenon Zabinski | zdog | zdog7@hotmail.com

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://37079]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2018-04-24 01:25 GMTServer Error (Error ID 137611b98611)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?