Skip to content

Instantly share code, notes, and snippets.

@kevgs
Created January 9, 2014 22:13
Show Gist options
  • Save kevgs/8343057 to your computer and use it in GitHub Desktop.
Save kevgs/8343057 to your computer and use it in GitHub Desktop.
import MySQLdb
import sys
db = MySQLdb.connect(host='0', port=9306)
c = db.cursor()
for i in range(100):
c.execute("""SELECT 1234, 1235 FROM goods_main limit %s""" % sys.argv[1])
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 100
real 0m0.890s
user 0m0.077s
sys 0m0.009s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 200
real 0m1.074s
user 0m0.088s
sys 0m0.015s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 300
real 0m1.062s
user 0m0.102s
sys 0m0.009s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 400
real 0m1.293s
user 0m0.097s
sys 0m0.032s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 500
real 0m1.437s
user 0m0.121s
sys 0m0.019s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 600
real 0m5.574s
user 0m0.077s
sys 0m0.123s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 700
real 0m5.561s
user 0m0.154s
sys 0m0.061s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 800
real 0m5.586s
user 0m0.166s
sys 0m0.062s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 900
real 0m5.574s
user 0m0.138s
sys 0m0.103s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 1000
real 0m5.630s
user 0m0.173s
sys 0m0.087s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 2000
real 0m5.641s
user 0m0.232s
sys 0m0.042s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 5000
real 0m5.564s
user 0m0.224s
sys 0m0.032s
kevg@kevg-laptop:~/sphinx/api$ time python mytest.py 50000
real 0m5.648s
user 0m0.157s
sys 0m0.117s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment