-
-
Save edenc/8ff84819c38bf19c3151 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
use strict; | |
use Benchmark qw(cmpthese); | |
use DBI; | |
my $dbh = DBI->connect('dbi:Pg:'); | |
my $st1 = $dbh->prepare('select email from test where email = ?'); | |
my $st2 = $dbh->prepare('select email from test where md5(email) = md5(?)'); | |
cmpthese( | |
999999 => { | |
HitNormal => sub { $st1->execute('c4ca4238a0b923820dcc509a6f75849b') }, | |
HitMD5 => sub { $st2->execute('c4ca4238a0b923820dcc509a6f75849b') }, | |
MissNormal => sub { $st1->execute('bogus') }, | |
MissMD5 => sub { $st2->execute('bogus') } | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment