From eee28c05a37edb8220fc9ab7828a73ff014bc77d Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 25 Mar 2009 00:03:06 +0000 Subject: [PATCH] implement same benchmarks as redis-benchmark in C with comparable results and rnd variant for comparison (I do see some fuzz in results of perl benchmark which aren't there for C version, so I suspect perl as culprit, and not Redis :-) git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@56 447b33ff-793d-4489-8442-9bea7d161be5 --- scripts/redis-benchmark.pl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/redis-benchmark.pl b/scripts/redis-benchmark.pl index e827817..74759b0 100755 --- a/scripts/redis-benchmark.pl +++ b/scripts/redis-benchmark.pl @@ -8,11 +8,17 @@ use Redis; my $r = Redis->new; +my $i = 0; + timethese( 100000, { - 'ping' => sub { $r->ping }, - 'set' => sub { $r->set( 'bench-' . rand(), rand() ) }, - 'get' => sub { $r->get( 'bench-' . rand() ) }, - 'incr' => sub { $r->incr( 'bench-incr' ) }, - 'lpush' => sub { $r->lpush( 'bench-lpush', rand() ) }, - 'lpop' => sub { $r->lpop( 'bench-lpop' ) }, + '00_ping' => sub { $r->ping }, + '10_set' => sub { $r->set( 'foo', $i++ ) }, + '11_set_r' => sub { $r->set( 'bench-' . rand(), rand() ) }, + '20_get' => sub { $r->get( 'foo' ) }, + '21_get_r' => sub { $r->get( 'bench-' . rand() ) }, + '30_incr' => sub { $r->incr( 'counter' ) }, + '30_incr_r' => sub { $r->incr( 'bench-' . rand() ) }, + '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) }, + '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) }, + '50_lpop' => sub { $r->lpop( 'mylist' ) }, }); -- 2.20.1