import numpy as np
import time
start =time.clock()
end = time.clock()
np_array = np.arange(10000000)
for i in range(10):np_array * 2
print('Running time: %s Seconds'%(end-start))
start2 =time.clock()
end2 = time.clock()
py_array = list(range(10000000))
for i in range(10):[x * 2 for x in py_array]
print('Running time: %s Seconds'%(end2-start2))
NumPy与Python性能差异对比
最新推荐文章于 2022-04-30 23:02:55 发布