Created
March 20, 2013 14:45
-
-
Save mackee/5205203 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.016; | |
use Benchmark qw/cmpthese/; | |
use DateTime::Tiny; | |
cmpthese 0, { | |
'Moose MongoDB' => sub { | |
use lib qw{ mongo-perl-driver/blib/lib mongo-perl-driver/blib/arch }; | |
use MongoDB; | |
{ | |
my $client = MongoDB::MongoClient->new(host => 'localhost'); | |
my $col = $client->get_database('test')->get_collection('test'); | |
my $id = $col->insert({ time => DateTime::Tiny->now() }); | |
my $data = $col->find({ _id => $id }); | |
} | |
}, | |
'Mouse MongoDB' => sub { | |
use lib qw{ mongo-perl-driver-with-mouse/blib/lib mongo-perl-driver-with-mouse/blib/arch }; | |
use MongoDB; | |
{ | |
my $client = MongoDB::MongoClient->new(host => 'localhost'); | |
my $col = $client->get_database('test')->get_collection('test'); | |
my $id = $col->insert({ time => DateTime::Tiny->now() }); | |
my $data = $col->find({ _id => $id }); | |
} | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment