- 计算量小的时候numba反而不如原生python
- numba使用nopython模式需要函数内所有对象都支持nopython
def sum(arr):
s_time = time.time()
m = arr.shape[0]
result = 0.0
for i in range(m):
result += arr[i]
e_time = time.time()
return (e_time-s_time)
def sum(arr):
s_time = time.time()
m = arr.shape[0]
result = 0.0
for i in range(m):
result += arr[i]
e_time = time.time()
return (e_time-s_time)