pitrou commented on issue #40874:
URL: https://github.com/apache/arrow/issues/40874#issuecomment-2025528866

   Well, this really seems to be a problem with jemalloc actually:
   ```python
   >>> arr = pa.array([42]*1_000_000, type=pa.int64())
   
   >>> %timeit arr.cast(pa.float64(), safe=False, 
memory_pool=pa.jemalloc_memory_pool())
   2.17 ms ± 19.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
   >>> %timeit arr[:10_000].cast(pa.float64(), safe=False, 
memory_pool=pa.jemalloc_memory_pool())
   8.86 µs ± 41 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
   
   >>> %timeit arr.cast(pa.float64(), safe=False, 
memory_pool=pa.mimalloc_memory_pool())
   545 µs ± 6.75 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
   >>> %timeit arr[:10_000].cast(pa.float64(), safe=False, 
memory_pool=pa.mimalloc_memory_pool())
   8.16 µs ± 25.2 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
   
   >>> %timeit arr.cast(pa.float64(), safe=False, 
memory_pool=pa.system_memory_pool())
   802 µs ± 2.23 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
   >>> %timeit arr[:10_000].cast(pa.float64(), safe=False, 
memory_pool=pa.system_memory_pool())
   8.81 µs ± 32 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
   
   >>> np_arr = arr.to_numpy()
   >>> %timeit np_arr.astype('float64')
   514 µs ± 2.54 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to