清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
from sqlite3 import * import os, time, datetime, platform path = "./testP.sqlite" log = open("./testP.log", "a+") con = connect(path) def prepare(): global con con.close() try: os.remove(path) print path, 'deleted' except (WindowsError): pass con = connect(path) def testCreate(n): c = con.cursor() for i in xrange(n): c.execute("create table test%d (id int)"%(i)) con.commit() c.close() def testInsert(n): c = con.cursor() c.execute("create table testinsert (id int)") for i in xrange(n): c.execute("insert into testinsert (id) values (%d)"%(i)) con.commit() c.close() def showTime(x, n): begin=datetime.datetime.today() x(n) end =datetime.datetime.today() print "run %s %d\t times"%(x.func_name,n), end-begin log.write("%s %s run %s %d\t times %s\n"%(platform.node(), platform.processor(),x.func_name,n, end-begin)) if __name__=='__main__': prepare() showTime(testCreate, 1000) showTime(testInsert, 1000000)