Why is passing a list (of length n) to a numba nopython function an O(n) operation
This is only a question to satisfy my curiosity I'm not actually planning on using lists as arguments for a numba function. But I was wondering why passing a list to a numba function seems like an O(n) operation, while it's an O(1) operation in pure-Python functions. Some simple example code: import numba as nb @nb.njit def take_list(lst): return None take_list([1, 2, 3]) # warmup And the timings: for size in [10, 100, 1000, 10000, 100000, 1000000]: lst = [0]*size print(len(lst)) %timeit take_list(lst) # IPythons "magic" timeit Results: 10 4.06 µs ± 26.1 ns per loop (mean ± std. dev. of 7 runs