2019-04-18
阅读量:
708
如何使一个小数组的求和速度快于np。求和?
Z = np.arange(10)
%timeit np.sum(Z)
%timeit np.add.reduce(Z)
The slowest run took 21.24 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 2.08 µs per loop
The slowest run took 10.39 times longer than the fastest. This could mean that an intermediate result is being cached.
1000000 loops, best of 3: 1.15 µs per loop
54.5455
1
3
关注作者
收藏
评论(0)
发表评论
暂无数据

