[Redis] Perl Redis Client news

Pavel Shaydo pshajdo at gmail.com
Wed Nov 20 02:36:04 GMT 2013


On Wed, Nov 20, 2013 at 3:58 AM, Steffen Mueller <smueller at cpan.org> wrote:
> On 11/19/2013 04:51 PM, Pavel Shaydo wrote:
>> It was some time ago, and I have no time right now to repeat
>> benchmarks, but if I remember correctly RedisDB XS parser is about 30%
>> faster than RedisDB PP parser.

I meant to say that RedisDB performance with XS parser was about 30%
higher than RedisDB performance with PP parser on a simple pipelining
test like this:

$ cat pipelining_test.pl
use 5.010;
use strict;
use warnings;
use RedisDB;

my $redis = RedisDB->new;

for (1..100000) {
    $redis->set('foo', 'bar', RedisDB::IGNORE_REPLY);
}
$redis->get_all_replies;

$ time perl pipelining_test.pl

real 0m3.075s
user 0m2.217s
sys 0m0.851s
$ time REDISDB_PARSER_PP=1 perl pipelining_test.pl

real 0m4.715s
user 0m3.383s
sys 0m1.327s

Measuring performance of parsers itself, without IO gives result that
is close to yours, XS is about 19 times faster:

$ cat parser_bench.pl
use 5.010;
use strict;
use warnings;
use Benchmark qw(cmpthese);
use RedisDB::Parse::Redis_XS;
use RedisDB::Parse::Redis_PP;

my $reply = join "\r\n", qw(
  *3
  :123
  $-1
  $9
  hhhhhhhhh
), "";

my ($xsc, $ppc);
my $xs = RedisDB::Parse::Redis_XS->new;
$xs->set_default_callback(sub { $xsc++ });
my $pp = RedisDB::Parse::Redis_PP->new;
$pp->set_default_callback(sub { $ppc++ });

cmpthese( -2, {
        pp => sub { $pp->add($reply) for 1..1000 },
        xs => sub { $xs->add($reply) for 1..1000 },
});

$ perl parser_bench.pl
     Rate    pp    xs
pp 24.8/s    --  -95%
xs  505/s 1938%    --


Pavel Shaydo



More information about the Redis mailing list