time[sec] | |
---|---|
CPython 3.4.2(6f78fcb) | 20.5 |
CPython 3.4.2(a724607) | 14.2 |
PyPy 2.5 (6f78fcb) | 3.4 |
PyPy 2.5 (a724607) | 3.1 |
CPython (mysqlclient) | 2.8 |
Dataset is "world database (innodb)". It is deployed on here
import MySQLdb | |
import timeit | |
conn = MySQLdb.connect(user='root', db='test_pymysql', charset='utf8') | |
def load_city(): | |
cur = conn.cursor() | |
cur.execute('SELECT * FROM City LIMIT 1000') | |
cur.fetchall() | |
cur.close() | |
print(timeit.timeit(load_city, number=1000)) |
import pymysql | |
import timeit | |
conn = pymysql.connect(user='root', db='test_pymysql', charset='utf8') | |
def load_city(): | |
cur = conn.cursor() | |
cur.execute('SELECT * FROM City LIMIT 1000') | |
cur.fetchall() | |
cur.close() | |
print(timeit.timeit(load_city, number=1000)) |