#!/usr/bin/perl
use v5.14;
use warnings;

use lib 'lib';

use Benchmark;
use Gruntmaster::Data;

my $db = Gruntmaster::Data->connect('dbi:Pg:');

timethese(-1, {
	orig => sub { $db->user_list_orig },
	new  => sub { $db->user_entry },
});

timethese(-1, {
	orig => sub { $db->user_entry_orig('PlayLikeNeverB4') },
	new  => sub { $db->user_entry('PlayLikeNeverB4') },
});

timethese(-1, {
	orig => sub { $db->contest_list_orig },
	new  => sub { $db->contest_entry },
});

timethese(-1, {
	orig => sub { $db->contest_entry_orig('mc2015r4') },
	new  => sub { $db->contest_entry('mc2015r4') },
});

timethese(-1, {
	orig => sub { $db->problem_list_orig },
	new  => sub { $db->problem_list },
});

timethese(-1, {
	orig => sub { $db->problem_entry_orig('aplusb') },
	new  => sub { $db->problem_entry('aplusb') },
});

timethese(50, {
	orig => sub { $db->job_list_orig },
	new  => sub { $db->job_list },
});

timethese(-1, {
	orig => sub { $db->job_entry_orig(9000) },
	new  => sub { $db->job_entry(9000) },
});

timethese(10, {
	orig => sub { $db->update_status_orig },
	new  => sub { $db->update_status },
});
