adventofcode/2024/06/benchmark.pl
2024-12-10 18:34:16 -05:00

23 lines
465 B
Perl
Executable File

#!/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;