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

RE: Set String Length (benchmark)

by Russ (Deacon)
on Jul 27, 2000 at 07:43 UTC ( [id://24625]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print substr($String, 0, 10);
    
  2. or download this
    timethese(1000000, {
      pack   => q{ my $String = 'Russ is a stud'; $String = pack("A10", $S
    +tring)},
      substr => q{ my $String = 'Russ is a stud'; $String = substr($String
    +, 0, 10)}
    });
    
  3. or download this
    Benchmark: timing 1000000 iterations of pack, substr...
          pack:  7 wallclock secs ( 7.20 usr +  0.00 sys =  7.20 CPU)
        substr:  6 wallclock secs ( 6.67 usr +  0.01 sys =  6.68 CPU)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-28 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found