[Redis] Perl Redis Client news

Steffen Mueller smueller at cpan.org
Tue Nov 19 21:58:15 GMT 2013


On 11/19/2013 10:35 PM, Damien Krotkine wrote:
> On Tue, Nov 19, 2013, at 11:58 AM, Steffen Mueller wrote:
>> I did a fairly naive[1] XS implementation of a parser and another fairly

>> So that's a factor of ~17x. :)

> How does Protocol::Redis::XS perform on the same scenario ?

NB: Turns out P::R::XS was written by DGL. That's usually a good sign 
David does good, solid stuff!

perl:  3 wallclock secs ( 2.08 usr +  0.00 sys =  2.08 CPU) @ 
128149.52/s (n=266551)
prxs:  2 wallclock secs ( 2.04 usr +  0.00 sys =  2.04 CPU) @ 
429311.27/s (n=875795)
xs:  2 wallclock secs ( 2.07 usr +  0.00 sys =  2.07 CPU) @ 2216193.24/s 
(n=4587520)

Code's in the repository I pointed at before. P::R::XS does more than my 
hacky prototype, though. It builds a much more complete data structure 
description than my code. It also uses hiredis to do the parsing. Here's 
its output:

            'data' => [
                       {
                         'data' => 123,
                         'type' => ':'
                       },
                       {
                         'data' => undef,
                         'type' => '$'
                       },
                       {
                         'data' => 'hhhhhhhhh',
                         'type' => '$'
                       }
                     ],
           'type' => '*'
         };

Now it's just that I don't think that level of information is actually 
necessary for a Perl client module. Redis (the server) treats values as 
byte sequences anyway, so what's the difference beyond status kind of 
values?

> That, plus dealing with streaming seems to require a lot of work
> implementing and testing .

Nah. It's work but not that much. Simple protocol and all. My hack took 
all of a train ride of an hour and a half hour or so from the night 
before. That just leaves the second 100% to implement. :)

Anyway, please don't take my emails for something they're not. I know 
the difference between a fun hack and production code pretty well. I'm 
not proposing dropping this into Redis.pm now! I had a good time writing 
some code.

Cheers,
Steffen



More information about the Redis mailing list