Skip to content

Instantly share code, notes, and snippets.

@tomislater
Created September 28, 2013 15:46
Show Gist options
  • Select an option

  • Save tomislater/6743365 to your computer and use it in GitHub Desktop.

Select an option

Save tomislater/6743365 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import timeit
from memcache import Client
mc = Client(['127.0.0.1:11211'], debug=0)
def worker():
for s in (str(i) for i in xrange(1000)):
mc.set(s, s.capitalize())
mc.get(s)
mc.incr(s, 1)
mc.decr(s, 1)
t = 0
for _ in xrange(3):
t += timeit.timeit(worker, number=100)
print t / 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment