Created
September 5, 2012 14:31
-
-
Save llimllib/3637502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis elapsed: 0.00105381011963 | |
1234567890 | |
pg elapsed: 0.00156402587891 | |
1234567890 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from redis import Redis | |
r = Redis() | |
s1 = time.time() | |
c = r.execute_command("get", "test") | |
s2 = time.time() | |
print "redis elapsed: ", s2-s1 | |
print c[:10] | |
from psycopg2 import connect | |
conn = connect("dbname=fuse_test user=bill") | |
cur = conn.cursor() | |
s1 = time.time() | |
cur.execute("SELECT value FROM metrics") | |
c = cur.fetchone() | |
s2 = time.time() | |
print "pg elapsed: ", s2-s1 | |
print c[0][:10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment