<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use warnings;
use strict;
use Benchmark qw/:all/;
use lib 'lib';
use Redis;

my $r = Redis-&gt;new;

my $i = 0;

timethese( 100000, {
	'00_ping'	=&gt; sub { $r-&gt;ping },
	'10_set'	=&gt; sub { $r-&gt;set( 'foo', $i++ ) },
	'11_set_r'	=&gt; sub { $r-&gt;set( 'bench-' . rand(), rand() ) },
	'20_get'	=&gt; sub { $r-&gt;get( 'foo' ) },
	'21_get_r'	=&gt; sub { $r-&gt;get( 'bench-' . rand() ) },
	'30_incr'	=&gt; sub { $r-&gt;incr( 'counter' ) },
	'30_incr_r'	=&gt; sub { $r-&gt;incr( 'bench-' . rand() ) },
	'40_lpush'	=&gt; sub { $r-&gt;lpush( 'mylist', 'bar' ) },
	'40_lpush'	=&gt; sub { $r-&gt;lpush( 'mylist', 'bar' ) },
	'50_lpop'	=&gt; sub { $r-&gt;lpop( 'mylist' ) },
});
</pre></body></html>