/[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

Annotation of /scripts/redis-benchmark.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60 - (hide annotations)
Sun Jul 26 01:33:13 2009 UTC (14 years, 9 months ago) by dpavlin
File MIME type: text/plain
File size: 810 byte(s)
added Redis::Hash benchmarks
1 dpavlin 52 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5     use Benchmark qw/:all/;
6     use lib 'lib';
7     use Redis;
8 dpavlin 60 use Redis::Hash;
9 dpavlin 52
10     my $r = Redis->new;
11    
12 dpavlin 60 my %hash;
13     tie %hash, 'Redis::Hash', 'hash';
14    
15 dpavlin 56 my $i = 0;
16    
17 dpavlin 52 timethese( 100000, {
18 dpavlin 56 '00_ping' => sub { $r->ping },
19     '10_set' => sub { $r->set( 'foo', $i++ ) },
20     '11_set_r' => sub { $r->set( 'bench-' . rand(), rand() ) },
21     '20_get' => sub { $r->get( 'foo' ) },
22     '21_get_r' => sub { $r->get( 'bench-' . rand() ) },
23     '30_incr' => sub { $r->incr( 'counter' ) },
24     '30_incr_r' => sub { $r->incr( 'bench-' . rand() ) },
25     '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) },
26     '40_lpush' => sub { $r->lpush( 'mylist', 'bar' ) },
27     '50_lpop' => sub { $r->lpop( 'mylist' ) },
28 dpavlin 60 '90_h_set' => sub { $hash{ 'test' . rand() } = rand() },
29     '90_h_get' => sub { my $a = $hash{ 'test' . rand() }; },
30 dpavlin 52 });

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26