Created
May 11, 2011 15:30
-
-
Save heavenshell/966682 to your computer and use it in GitHub Desktop.
Tiny benchmarks for Net::Riak
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
use Net::Okuyama; | |
use Net::Riak; | |
my $okuyama = Net::Okuyama->new(hosts => 'localhost:8888'); | |
$okuyama->set('foo' => 'bar'); | |
my $riak = Net::Riak->new( | |
transport => 'PBC', host => 'localhost', port => 8087 | |
); | |
my $bucket = $riak->bucket('benchmark'); | |
$bucket->new_object('foo', {value => 'bar'})->store; | |
timethese( | |
10000 => +{ | |
'Net::Okuyama set' => sub { | |
$okuyama->set('foo' => 'bar'); | |
}, | |
'Net::Okuyama get' => sub { | |
$okuyama->get('foo'); | |
}, | |
'Net::Riak set' => sub { | |
$bucket->new_object('foo', {value => 'bar'})->store; | |
}, | |
'Net::Riak get' => sub { | |
$bucket->get('foo')->data->{value}; | |
}, | |
} | |
); |
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
Benchmark: timing 10000 iterations of Net::Okuyama get, Net::Okuyama set, Net::Riak get, Net::Riak set... | |
Net::Okuyama get: 4 wallclock secs ( 0.33 usr + 0.26 sys = 0.59 CPU) @ 16949.15/s (n=10000) | |
Net::Okuyama set: 3 wallclock secs ( 0.33 usr + 0.27 sys = 0.60 CPU) @ 16666.67/s (n=10000) | |
Net::Riak get: 35 wallclock secs (11.67 usr + 1.30 sys = 12.97 CPU) @ 771.01/s (n=10000) | |
Net::Riak set: 25 wallclock secs (10.19 usr + 1.08 sys = 11.27 CPU) @ 887.31/s (n=10000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment