Skip to content

Speeding up Numba JIT-compiled functions that use ArrayBuilder #696

Answered by jpivarski
mova asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a way to find out: compile a function and look at its overloaded types.

>>> import awkward as ak
>>> import numba as nb
>>> @nb.njit
... def do_nothing(builder, array):
...   pass
... 
>>> do_nothing.overloads.keys()
odict_keys([])

(Nothing yet because we haven't compiled anything yet.)

>>> do_nothing(ak.ArrayBuilder(), ak.Array([[1, 2, 3], [], [4, 5]]))
>>> do_nothing.overloads.keys()
odict_keys([
    (ak.ArrayBuilderType(None),    # <---- the ArrayBuilder is opaque
     ak.ArrayView(                 # <---- the Array is specialized
         ak.ListArrayType(
             array(int64, 1d, C),
             ak.NumpyArrayType(array(int64, 1d, A), none, {}),
             none, {}),
  …

Replies: 1 comment 1 reply

Comment options

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

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