Antoine Pitrou created ARROW-2514:
-------------------------------------

             Summary: [Python] Inferring / converting nested Numpy array is 
very slow
                 Key: ARROW-2514
                 URL: https://issues.apache.org/jira/browse/ARROW-2514
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 0.9.0
            Reporter: Antoine Pitrou


Converting a nested Numpy array nested walks over the Numpy data as Python 
objects, even if the dtype is not "object". This makes it pointlessly slow 
compared to the non-nested case, and even the nested Python list case:

{code:python}
>>> %%timeit data = list(range(10000))
...:pa.array(data)
...:
746 µs ± 8.36 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
>>> %%timeit data = np.arange(10000)
...:pa.array(data)
...:
81.1 µs ± 57.7 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
>>> %%timeit data = [np.arange(10000)]
...:pa.array(data)
...:
3.39 ms ± 6.27 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to