I'm iterating csv files with 10k-100k rows millions of times so performance is of crucial importance. I'm going line by line optimizing every line to squeeze every fraction of a second. This is simple just cloning one dataframe series. Currently confused with these initial results.
@numba.jit()
def test(x):
return x
#%%timeit
df['source'] = df['Close']
#79.5 µs ± 3.58 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
#%%timeit
df['source2'] = test(df['Close'].to_numpy())
#88.1 µs ± 683 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
The overall elapsed time is faster in the first, but the per loop is faster in the second. If the per loop is faster, I would expect it to be faster overall.
Does this mean that there is that much more time being utilized in the back end? Can someone explain this to me.
Should I give more importance to the total elapsed time or the per loop time?
Note, I'm using Jupyter notebook on Anaconda.