apache / apache/arrow

[C++][Compute] Optimize min/max_element_wise with word at a time validity handling

Open
#50,645 1 comment 0 reactions 1 assignee Claimed by @Kanishk-Dendukuri View on GitHub
Component: C++ Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

The variadic min_element_wise / max_element_wise kernels (ScalarMinMax in scalar_compare.cc) fold arguments using a multi pass approach: an antiextreme sentinel fill, a separate validity bitmap pass (BitmapOr/BitmapAnd), and a per element value pass with a per element validity branch.

This can be rewritten as a single word at a time pass (handling validity 64 bits at a time) that fuses validity and value computation and keeps fully valid words branchless. That removes the redundant passes and the per element mispredicting branch, giving a measured ~2-7x speedup on numeric types (varying with shape and null density), with no behavioral change.

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.