Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Timing Your Program

by lhoward (Vicar)
on Oct 02, 2001 at 00:21 UTC ( [id://115957]=note: print w/replies, xml ) Need Help??


in reply to Timing Your Program

You may also want to check out the Benchmark module.

Replies are listed 'Best First'.
Re: Re: Timing Your Program
by htoug (Deacon) on Oct 02, 2001 at 09:54 UTC
    Note that it is part of the perl core (as of perl5.003_07).

    It does just what you want, ie. allows you to compare the execution times of different approaches.

Sample code for Benchmark
by joealba (Hermit) on Oct 03, 2001 at 21:51 UTC
    use Benchmark; my $t0 = new Benchmark; # See code run my $t1 = new Benchmark; my $td = timediff($t1, $t0); print timestr($td) . "\n";
    Use as many or as few of those Benchmark objects as you'd like at any point in the program. The CPAN docs on Benchmark are great, but I thought it may be helpful to see the code right here. Instant gratification is key. :)
      what module does Benchmark come from?
        Benchmark -- It's its own module -- in the standard Perl distrib.

Log In?
Username:
Password:

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

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

    No recent polls found