Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def incALot(y):
- x = 0
- while x < y:
- x += 1
- @njit('i8(i8)')
- def nbIncALot(y):
- x = 0
- while x < y:
- x += 1
- return x
- size = 1000000000
- start = time.time()
- incALot(size)
- t1 = time.time() - start
- start = time.time()
- x = nbIncALot(size)
- t2 = time.time() - start
- print('CPython3 takes %.3fs, Numba takes %.9fs' %(t1, t2))
- print('Speedup is: %.1f' % (t1/t2))
- print('Just Checking:', x)
- CPython3 takes 58.958s, Numba takes 0.000007153s
- Speedup is: 8242982.2
- Just Checking: 1000000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement