root/lang/perl/Cache-Memcached-LibMemcached/trunk/tools/benchmark.pl @ 4543

Revision 4543, 0.5 kB (checked in by daisuke, 6 years ago)

lang/perl/Cache-Memcached-LibMemcached?; add benchmark script

Line 
1use strict;
2use Benchmark qw(cmpthese);
3use Cache::Memcached;
4use Cache::Memcached::LibMemcached;
5
6my %args = (
7    servers => [ qw(localhost:11211) ],
8    compess_threshold => 1_000,
9);
10
11my $data = '0123456789' x 10;
12
13my $memd = Cache::Memcached->new(\%args);
14my $libmemd = Cache::Memcached::LibMemcached->new(\%args);
15$libmemd->set( 'foo', $data );
16
17cmpthese(50_000, {
18    perl_memcahed => sub {
19        ($memd->get('foo') eq $data) or die;
20    },
21    libmemcached  => sub {
22        ($libmemd->get('foo') eq $data) or die;
23    },
24});
Note: See TracBrowser for help on using the browser.