| 1234567891011121314151617181920212223242526272829303132 |
- from web3Tools import *
- import pymysql
- def speedTest(function, *args):
- intiTime = time.time()
- i = 0
- while time.time() -1 < intiTime:
- function(*args)
- i = i +1
- return i
- def test0():
- return EthMevModel.find_by_hash('0x73cfd86895f97db1fbf555cdd449b115ce1a10c2')
- def test1():
- cursor.execute(SQL)
- data = cursor.fetchone()
- return data
- db = pymysql.connect(host='127.0.0.1',
- user='root',
- password='Qwe410410.',
- database='ethmev')
- cursor = db.cursor()
- db.ping(reconnect=True)
- SQL = "SELECT * FROM t_ethereum_mev_v1 WHERE hash='%s'" % "0x73cfd86895f97db1fbf555cdd449b115ce1a10c2"
- printTime(test0())
- printTime(test1())
- printTime(speedTest(test0,), 'JAVA API')
- printTime(speedTest(test1,), 'PY SQL')
- cursor.close()
|