benchmark



use Benchmark;  module

# declare array
my @data;

# start timer
$start = new Benchmark;

# perform a math operation 200000 times
for ($x=0; $x<=200000; $x++)
{
      $data[$x] = $x/($x+2);
}

# end timer
$end = new Benchmark;

# calculate difference
$diff = timediff($end, $start);

# report
print "Time taken was ", timestr($diff, 'all'), " seconds";

1

1 Total

Feedback