Skip to content

Instantly share code, notes, and snippets.

@LotharSee
Created July 29, 2014 00:08
Show Gist options
  • Save LotharSee/65cca23e07fb532f9050 to your computer and use it in GitHub Desktop.
Save LotharSee/65cca23e07fb532f9050 to your computer and use it in GitHub Desktop.
redis-py benchmark
results = {}
(1..10).each do
['2.4.13', '2.9.1', '2.10.1', 'master'].each do |v|
results[v] ||= {}
['10', '50','100', '500', '1000', '5000', '10000', '50000', '100000'].each do |s|
`git checkout #{v}`
results[v][s] ||= 0
results[v][s] += `python main-bench.py #{s}`.to_f
puts v
end
end
end
puts results
#!/usr/bin/env python
import redis
import time
import sys
now = time.time()
r = redis.Redis()
pipe = r.pipeline()
payload = "a" * int(sys.argv[1])
for x in xrange(10000):
x += 1
if x%1000 == 0:
pipe.execute()
pipe.set(x, payload)
pipe.execute()
print time.time() - now
r.flushdb()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment