adventofcode/2024/06/benchmark.pl

23 lines
465 B
Perl
Raw Permalink Normal View History

2024-12-10 23:34:16 +00:00
#!/usr/bin/env perl
use 5.36.0;
use Benchmark qw/ timethis timeit /;
use lib qw~ . ~;
use Part1;
use Part2;
use Path::Tiny;
use File::Serialize;
my $sample = -f 'sample' && Part1::read_input( path('sample') );
my $input= -f 'input' && Part1::read_input( path('input') );
my $res;
$res = timeit(0, sub { Part1::solve($input) });
say "part 1: ", $res->cpu_a/$res->iters;
$res = timeit(0, sub { Part2::solve($input) });
say "part 2: ", $res->cpu_a/$res->iters;