Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: How expensive is reverse?

by nardo (Friar)
on Sep 01, 2001 at 22:08 UTC ( [id://109662]=note: print w/replies, xml ) Need Help??


in reply to Re: How expensive is reverse?
in thread How expensive is reverse?

ITYM
@one = (('a') x 100); @two = (('a') x 1000); @three = (('a') x 10000);
As it is written each array has one element 100, 1000, or 10000 characters long rather than having 100, 1000, or 10000 elements one character long. With this change (and changing it to run 10,000 times) I get:
Benchmark: timing 10000 iterations of rev 100, rev 1000, rev 10000... rev 100: 0 wallclock secs ( 0.54 usr + -0.01 sys = 0.53 CPU) @ 18 +867.92/s (n=10000) rev 1000: 4 wallclock secs ( 5.52 usr + -0.01 sys = 5.51 CPU) @ 18 +14.88/s (n=10000) rev 10000: 59 wallclock secs (58.33 usr + -0.00 sys = 58.33 CPU) @ 17 +1.44/s (n=10000)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found