[tpm] Is there a three-way version of...

Uri Guttman uri at StemSystems.com
Sat May 30 23:20:05 PDT 2009

>>>>> "SF" == Shaun Fryer <sfryer at sourcery.ca> writes:

  SF>     my $start_foo = time;
  SF>     foo() for 0 .. $iterations;
  SF>     my $end_foo = time;
  SF>     my $foo_time = $end_foo - $start_foo;

  SF>     print "foo() took $foo_time seconds\n";
  SF>     print "bar() took $bar_time seconds\n";

this is wall clock time which is not a good measure of code
efficiency. use the Benchmark.pm module (in core perl) which is the
standard way to do this. it measures cpu time, is more accurate, is
easier to use and has many options, features and reporting styles. all
perl hackers should know the benchmark module.


Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

More information about the toronto-pm mailing list