2021
03-11
03-11
基于python不同开根号的速度对比分析
我就废话不多说了,大家还是直接看代码吧~importtimeimportmathimportnumpyasnpdeftimeit1():s=time.time()foriinrange(750000):z=i**.5print("Took%fseconds"%(time.time()-s))deftimeit2(arg=math.sqrt):s=time.time()foriinrange(750000):z=arg(i)print("Took%fseconds"%(time.time()-s))deftimeit3(arg=np.sqrt):s=time.time()foriinrange(750000):z=arg(i)print("Took...
继续阅读 >