Skip to content

Instantly share code, notes, and snippets.

@proteneer
Created December 12, 2013 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proteneer/7937406 to your computer and use it in GitHub Desktop.
Save proteneer/7937406 to your computer and use it in GitHub Desktop.
count = 10000
start = time.time()
for i in range(count):
rc.set('bar',1)
rc.set('bar',1)
rc.set('bar',1)
rc.set('bar',1)
print time.time()-start
start = time.time()
for i in range(count):
pipe = rc.pipeline()
pipe.set('bar',1)
pipe.set('bar',1)
pipe.set('bar',1)
pipe.set('bar',1)
pipe.execute()
print time.time()-start
script = """
redis.call('SET','bar',1)
redis.call('SET','bar',1)
redis.call('SET','bar',1)
redis.call('SET','bar',1)
"""
fn = rc.register_script(script)
start = time.time()
for i in range(count):
fn()
print time.time()-start
#1.81718993187
#1.74941515923
#1.00952005386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment