]> git.saurik.com Git - redis.git/blame - client-libraries/perl/scripts/redis-benchmark.pl
ignore gcc warning about write() return code not checked. It is esplicitily this...
[redis.git] / client-libraries / perl / scripts / redis-benchmark.pl
CommitLineData
f78fd11b 1#!/usr/bin/perl
2
3use warnings;
4use strict;
5use Benchmark qw/:all/;
6use lib 'lib';
7use Redis;
8
9my $r = Redis->new;
10
11my $i = 0;
12
13timethese( 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});