viirya opened a new issue, #50448:
URL: https://github.com/apache/arrow/issues/50448

   ### Describe the enhancement requested
   
   Follow-up of #50326 (mechanism introduced in GH-50327). The scalar-free 
conversion currently makes one `_getitem_py` virtual call per element. Several 
per-element overheads could be batched per range, as suggested in the GH-50327 
review:
   
   1. Replace the per-element entry point with a `cdef list 
_getitem_range_py(self, int64_t offset, int64_t length)` used by `to_pylist` 
and the list/struct/map container loops, cutting per-element function-call and 
prologue overhead.
   2. Hoist the numeric type-id dispatch out of the loop: 
`NumericArray._getitem_py` currently walks an if/elif ladder per element even 
though the type is invariant; a per-range implementation (or per-concrete-class 
overrides) makes the loop monomorphic.
   3. Skip the per-element `IsNull` check when `null_count() == 0`.
   4. Read the offsets buffer pointer once per range in the list/map paths 
instead of calling `value_offset()` twice per row.
   
   None of these change semantics; they compound on top of the structural win 
in GH-50327 (no per-element Scalar / per-row Array wrapper allocation).
   
   ### Component(s)
   
   Python
   


-- 
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