Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Timing Your Program

by lhoward (Vicar)
on Oct 02, 2001 at 00:21 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2019-08-21 04:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found