Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^6: C-style for loop

by zwon (Abbot)
on Nov 15, 2008 at 23:00 UTC ( [id://723858]=note: print w/replies, xml ) Need Help??


in reply to Re^5: C-style for loop
in thread C-style for loop

It depends
#!/usr/bin/perl -- use strict; use warnings; use Benchmark qw(cmpthese); my $BIG = 100_000; cmpthese( 1000, { 'C-style' => \&c, 'P-style' => \&p } ); sub c { for ( my $i = 1 ; $i <= $BIG ; $i++ ) { 1; } } sub p { for ( 1 .. $BIG ) { 1; } } __END__ Rate C-style P-style C-style 141/s -- -29% P-style 200/s 42% --

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found