added Redis::Hash benchmarks
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 26 Jul 2009 01:33:13 +0000 (01:33 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 26 Jul 2009 01:33:13 +0000 (01:33 +0000)
git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/Redis@60 447b33ff-793d-4489-8442-9bea7d161be5

scripts/redis-benchmark.pl

index 74759b0..05fcdad 100755 (executable)
@@ -5,9 +5,13 @@ use strict;
 use Benchmark qw/:all/;
 use lib 'lib';
 use Redis;
+use Redis::Hash;
 
 my $r = Redis->new;
 
+my %hash;
+tie %hash, 'Redis::Hash', 'hash';
+
 my $i = 0;
 
 timethese( 100000, {
@@ -21,4 +25,6 @@ timethese( 100000, {
        '40_lpush'      => sub { $r->lpush( 'mylist', 'bar' ) },
        '40_lpush'      => sub { $r->lpush( 'mylist', 'bar' ) },
        '50_lpop'       => sub { $r->lpop( 'mylist' ) },
+       '90_h_set' => sub { $hash{ 'test' . rand() } = rand() },
+       '90_h_get' => sub { my $a = $hash{ 'test' . rand() }; },
 });