Skip to content

Instantly share code, notes, and snippets.

@pietern
Created March 30, 2011 08:00
Show Gist options
  • Save pietern/894026 to your computer and use it in GitHub Desktop.
Save pietern/894026 to your computer and use it in GitHub Desktop.

Output of benchmarking/pipeline.rb with hiredis C extension and pure Ruby implementation on MRI 1.9 and JRuby.

MRI 1.9.2 with hiredis extension

                              user     system      total        real
set                       0.370000   0.260000   0.630000 (  1.231756)
set (pipelined)           0.080000   0.000000   0.080000 (  0.110779)
lpush+ltrim               0.360000   0.250000   0.610000 (  1.231982)
lpush+ltrim (pipelined)   0.080000   0.010000   0.090000 (  0.142768)

MRI 1.9.2 with pure Ruby hiredis

                              user     system      total        real
set                       0.630000   0.260000   0.890000 (  1.505699)
set (pipelined)           0.320000   0.100000   0.420000 (  0.428920)
lpush+ltrim               0.640000   0.270000   0.910000 (  1.556305)
lpush+ltrim (pipelined)   0.350000   0.100000   0.450000 (  0.456538)

JRuby 1.6 with pure Ruby hiredis (after rehearsal, i.e. JIT has kicked in)

                              user     system      total        real
set                       1.866000   0.000000   1.866000 (  1.866000)
set (pipelined)           0.368000   0.000000   0.368000 (  0.368000)
lpush+ltrim               1.911000   0.000000   1.911000 (  1.911000)
lpush+ltrim (pipelined)   0.406000   0.000000   0.406000 (  0.406000)

Bootstrapping

Make sure Redis is running locally on the default port (6379).

cd /tmp
git clone git://github.com/pietern/hiredis-rb.git hiredis-rb-ruby
git clone git://github.com/pietern/hiredis-rb.git hiredis-rb-ext

cd hiredis-rb-ext
rake build
cd ..

git clone git://github.com/ezmobius/redis-rb.git redis-rb
cd redis-rb

rvm use 1.9.2
ruby -Ilib -I/tmp/hiredis-rb-ext/lib -r"redis/connection/hiredis" benchmarking/pipeline.rb

rvm use 1.9.2
ruby -Ilib -I/tmp/hiredis-rb-ruby/lib -r"redis/connection/hiredis" benchmarking/pipeline.rb

rvm use jruby
ruby -Ilib -I/tmp/hiredis-rb-ruby/lib -r"redis/connection/hiredis" benchmarking/pipeline.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment