Skip to content

Instantly share code, notes, and snippets.

@mackee
Created March 20, 2013 14:45
Show Gist options
  • Save mackee/5205203 to your computer and use it in GitHub Desktop.
Save mackee/5205203 to your computer and use it in GitHub Desktop.
#!/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