/[Redis.pre-github]/scripts/redis-benchmark.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /scripts/redis-benchmark.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56 - (show annotations)
Wed Mar 25 00:03:06 2009 UTC (15 years, 1 month ago) by dpavlin
File MIME type: text/plain
File size: 632 byte(s)
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 :-)
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 });

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26