我正在研究需要快速協程的東西,我相信numba可以加速我的代碼。 下面是一個愚蠢的例子:一個函數,它的輸入平方,並增加了它被調用的次數。 def make_square_plus_count():
i = 0
def square_plus_count(x):
nonlocal i
i += 1
return x**2 + i
re
我試圖比較使用基本示例的numba和純python,並且得到了奇怪的結果。 這是numba例如: from numba import jit
from numpy import arange
from time import time
# jit decorator tells Numba to compile this function.
# The argument types wil