from numba import jit
import time
@jit
def foo(x, y):
tt = time.time()
s = 0
for i in range(x, y):
s += i
print("Time used: {} sec".format(time.time() - tt))
return s
print(foo(1, 100000000))
c:\Users\wuyudi\Desktop\新建 Python File (3).py:5: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "foo" failed type inference due to: Unknown attribute 'time' of type Module(<module 'time' (built-in)>)
File "Desktop\新建 Python File (3).py", line 7:
def foo(x, y):
tt = time.time()
^
During: typing of get attribute at c:\Users\wuyudi\Desktop\新建 Python File (3).py (7)
File "Desktop\新建 Python File (3).py", line 7:
def foo(x, y):
tt = time.time()
^
@jit
c:\Users\wuyudi\Desktop\新建 Python File (3).py:5: NumbaWarning:
Compilation is falling back to object mode WITHOUT looplifting enabled because Function "foo" failed type inference due to: Cannot determine Numba type of <class 'numba.core.dispatcher.LiftedLoop'>
File "Desktop\新建 Python File (3).py", line 9:
def foo(x, y):
<source elided>
s = 0
for i in range(x, y):
^
@jit
D:\Program Files\Python3.8.5\lib\site-packages\numba\core\object_mode_passes.py:151: NumbaWarning: Function "foo" was compiled in object mode without forceobj=True, but has lifted loops.
File "Desktop\新建 Python File (3).py", line 7:
def foo(x, y):
tt = time.time()
^
warnings.warn(errors.NumbaWarning(warn_msg,
D:\Program Files\Python3.8.5\lib\site-packages\numba\core\object_mode_passes.py:161: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit https://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "Desktop\新建 Python File (3).py", line 7:
def foo(x, y):
tt = time.time()
^
warnings.warn(errors.NumbaDeprecationWarning(msg,
Time used: 0.12804293632507324 sec
887459712