Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: RE: Set String Length (benchmark)

by steveAZ98 (Monk)
on Jul 27, 2000 at 08:08 UTC ( #24628=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Benchmark;
    my $str = 'hello';
    ...
                'pack'      =>  q{  $str = pack("A10",$str);        },
                'sprintf'   =>  q{  $str = sprintf("%-10s",$str);   },
    });
    
  2. or download this
    Benchmark: timing 10000000 iterations of pack, sprintf...
          pack: 18 secs (16.86 usr  0.00 sys = 16.86 cpu)
       sprintf: 18 secs (17.36 usr  0.00 sys = 17.36 cpu)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2022-12-10 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?