我正在研究需要快速协程的东西,我相信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