programming-examples/perl/SystemFunction/use Benchmark to time a loop.pl
2019-11-15 12:59:38 +01:00

12 lines
276 B
Perl

use Benchmark;
$timestamp1 = new Benchmark;
for ($loop_index = 0; $loop_index < 1_000_000; $loop_index++) {
$variable1 = 1;
}
$timestamp2 = new Benchmark;
$timedifference = timediff($timestamp2, $timestamp1);
print "The loop took", timestr($timedifference);