Example of Numba ‘for loop’ execution with “empty” numpy array population

This example is perfect for showing how fast Numba can be with when put right with Nopython mode (@jit(nopython=True) or@njit) import numpy as np import numba as nb from numba import jit, njit import time start_time = time.time() # @nb.jit(nb.float64[:](nb.float64[:])) @njit def f(arr): res = np.zeros(len(arr)) for i in range(len(arr)): res[i] = (arr[i]) ** 2 … Read more