Skip to content

njit to speed up functions on awkward arrays #1824

Answered by agoose77
fspinna asked this question in Q&A
Discussion options

You must be logged in to vote

Awkward Array (and Numba's) performance can be measured approximately as time = initial_cost + rate*amount_of_work. In this case, your array is too small for the work-scaling to be properly measured, i.e. the setup costs (initial_cost) are dominating the performance.

If you change your array to be more like ~1,000,000 elements, then the performance difference between the two Numba jitted cases is closer to a factor of 4:1

%timeit ak.mean(ak_array, axis=1)
%timeit nb_ak_mean(ak_array)
%timeit nb_mean(lists_numba)
763 ms ± 19.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
117 ms ± 9.63 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
28.8 ms ± 1.55 ms per loop (mean ± std. dev…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@fspinna
Comment options

Comment options

You must be logged in to vote
4 replies
@fspinna
Comment options

@jpivarski
Comment options

@jpivarski
Comment options

@fspinna
Comment options

Answer selected by fspinna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants