Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

benchmark comment

by perlmonkey (Hermit)
on Jul 27, 2000 at 08:27 UTC ( [id://24630]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $str = 'hello';
    timethese( 1000000, {
        'pack'      =>  q{$str = pack("A10",$str);       },
        'sprintf'   =>  q{$str = sprintf("%-10s",$str);   },
    });
    
  2. or download this
    Benchmark: timing 1000000 iterations of pack, sprintf...
          pack:  3 wallclock secs ( 3.84 usr +  0.02 sys =  3.86 CPU)
       sprintf:  4 wallclock secs ( 4.24 usr +  0.00 sys =  4.24 CPU)
    
  3. or download this
    timethese( 1000000, {
        'pack'      =>  q{my $str = 'hello'; $str = pack("A10",$str);     
    +},
        'sprintf'   =>  q{my $str = 'hello'; $str = sprintf("%-10s",$str);
    +},
    });
    
  4. or download this
    Benchmark: timing 1000000 iterations of pack, sprintf...
          pack:  6 wallclock secs ( 5.82 usr +  0.03 sys =  5.85 CPU)
       sprintf:  7 wallclock secs ( 6.80 usr +  0.01 sys =  6.81 CPU)
    

Log In?
Username:
Password:

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

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

    No recent polls found