]> git.saurik.com Git - redis.git/blob - client-libraries/perl/scripts/redis-benchmark.pl
doc update
[redis.git] / client-libraries / perl / scripts / redis-benchmark.pl
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use Benchmark qw/:all/;
6 use lib 'lib';
7 use Redis;
8
9 my $r = Redis->new;
10
11 my $i = 0;
12
13 timethese( 100000, {
14 '00_ping' => sub { $r->ping },
15 '10_set' => sub { $r->set( 'foo', $i++ ) },
16 '11_set_r' => sub { $r->set( 'bench-' . rand(), rand() ) },
17 '20_get' => sub { $r->get( 'foo' ) },
18 '21_get_r' => sub { $r->get( 'bench-' . rand() ) },
19 '30_incr' => sub { $r->incr( 'counter' ) },
20 '30_incr_r' => sub { $r->incr( 'bench-' . rand() ) },
21 '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) },
22 '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) },
23 '50_lpop' => sub { $r->lpop( 'mylist' ) },
24 });