This code return slow and with different output:
from numba import jit
from timeit import default_timer as timer
def fibonacci(n):
a, b = 1, 1
for i in range(n):
a, b = a+b, a
return a
fibonacci_jit = jit(fibonacci)
let start the test
start = timer()
print fibonacci(100)
duration = timer() - start
let start the test
startnext = timer()
print fibonacci_jit(100)
durationnext = timer() - startnext
print(duration, durationnext)
The result:
C:\Python27>python numba_test_003.py
927372692193078999176
1445263496
(0.00038264393810854576, 0.17378674127528523)
#next
C:\Python27>python numba_test_003.py
927372692193078999176
1445263496
(0.0004830358514597401, 0.19266426987655644)