我正在使用带有i7-4810mq(Windows 7专业版64位版本)的dell笔记本电脑,现在我已将其更改为i7-5600u,带有Windows 10 pro 64bit。
问题是以下代码在我的旧笔记本电脑中最多需要2秒钟,但现在使用新处理器大约需要10分钟,如果我要在单核心工作台上比较2 cpus i7-4810mq只需要快10%。
两台计算机之间的差异只是处理器和操作系统,我看不到会给我带来太多麻烦的任何东西。任何帮助将不胜感激。
import pyodbc
import os
import datetime
import math
def setup_Dict(self):
today = datetime.datetime.today()
todaystr = today.strftime('%Y.%m.%d')
DBfile = 'C:/Users/kayd/Desktop/cfgdb/%s/cfg%s.mdb' %(todaystr, todaystr.replace('.', ''))
conn = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ='+DBfile)
cursor = conn.cursor()
ResultDict={}
SQL = 'SELECT MxRNC,CELLID,CELLNAME,LOCELL,BANDIND,UARFCNUPLINKIND,UARFCNUPLINK,UARFCNDOWNLINK,CFGRACIND,RAC,CNOPGRPINDEX,MAXTXPOWER,TCELL,NINSYNCIND,NOUTSYNCIND,TRLFAILURE,DLTPCPATTERN01COUNT,PSCRAMBCODE,TXDIVERSITYIND,SPGID,LAC,SAC,CIO,NODEBNAME,VPLIMITIND,DSSFLAG,DSSSMALLCOVMAXTXPOWER,CCHCNOPINDEX,DPGID,CELLHETFLAG FROM UCELLSETUP;'
for row in cursor.execute(SQL):
MxRNC=row.MxRNC
CELLID=row.CELLID
CELLNAME=row.CELLNAME
LOCELL=row.LOCELL
BANDIND=row.BANDIND
UARFCNUPLINKIND=row.UARFCNUPLINKIND
UARFCNUPLINK=row.UARFCNUPLINK
UARFCNDOWNLINK=row.UARFCNDOWNLINK
CFGRACIND=row.CFGRACIND
RAC=row.RAC
CNOPGRPINDEX=row.CNOPGRPINDEX
MAXTXPOWER=row.MAXTXPOWER
TCELL=row.TCELL
NINSYNCIND=row.NINSYNCIND
NOUTSYNCIND=row.NOUTSYNCIND
TRLFAILURE=row.TRLFAILURE
DLTPCPATTERN01COUNT=row.DLTPCPATTERN01COUNT
PSCRAMBCODE=row.PSCRAMBCODE
TXDIVERSITYIND=row.TXDIVERSITYIND
SPGID=row.SPGID
LAC=row.LAC
SAC=row.SAC
CIO=row.CIO
NODEBNAME=row.NODEBNAME
CELLHETFLAG=row.CELLHETFLAG
VPLIMITIND=row.VPLIMITIND
DSSFLAG=row.DSSFLAG
DSSSMALLCOVMAXTXPOWER=row.DSSSMALLCOVMAXTXPOWER
DPGID=row.DPGID
CCHCNOPINDEX=row.CCHCNOPINDEX
key = MxRNC + '_' + CELLID
ResultDict[key] = {'MxRNC':MxRNC,'CELLID':CELLID,'CELLNAME':CELLNAME,'LOCELL':LOCELL,'BANDIND':BANDIND,'UARFCNUPLINKIND':UARFCNUPLINKIND,'UARFCNUPLINK':UARFCNUPLINK,'UARFCNDOWNLINK':UARFCNDOWNLINK,'CFGRACIND':CFGRACIND,'RAC':RAC,'CNOPGRPINDEX':CNOPGRPINDEX,'MAXTXPOWER':MAXTXPOWER,'TCELL':TCELL,'NINSYNCIND':NINSYNCIND,'NOUTSYNCIND':NOUTSYNCIND,'TRLFAILURE':TRLFAILURE,'DLTPCPATTERN01COUNT':DLTPCPATTERN01COUNT,'PSCRAMBCODE':PSCRAMBCODE,'TXDIVERSITYIND':TXDIVERSITYIND,'SPGID':SPGID,'LAC':LAC,'SAC':SAC,'CIO':CIO,'NODEBNAME':NODEBNAME,'CELLHETFLAG':CELLHETFLAG,'VPLIMITIND':VPLIMITIND,'DSSFLAG':DSSFLAG,'DSSSMALLCOVMAXTXPOWER':DSSSMALLCOVMAXTXPOWER,'DPGID':DPGID,'CCHCNOPINDEX':CCHCNOPINDEX}