Skip to content

Conversation

@rluvaton
Copy link
Member

@rluvaton rluvaton commented Oct 23, 2025

Which issue does this PR close?

N/A

Rationale for this change

Improve the performance of array iterator functions by skipping null checks on non nullable

What changes are included in this PR?

override ArrayIter default function implementation with one that check if there are nulls or not:

  • nth / nth_back
  • last
  • count
  • for_each
  • fold / rfold
  • all
  • any
  • find_map
  • find / rfind
  • partition
  • position / rposition

this implement all functions in Iterator/DoubleEndedIterator that the default implementation is either using some base function that we can't implement in stable (e.g. try_fold) or the implementation is naive (e.g. calling next() a lot of times)

Are these changes tested?

Yes, a LOT

Are there any user-facing changes?

Nope


This include the following fix which was found while working on this:

…ull/non-nullable versions

implemented for:
- `nth` / `nth_back`
- `last`
- `count`
- `for_each`
- `fold` / `rfold`
- `all`
- `any`
- `find_map`
- `find` / `rfind`
- `partition`
- `position` / `rposition`
@github-actions github-actions bot added the arrow Changes to the arrow crate label Oct 23, 2025
rluvaton added a commit to rluvaton/arrow-rs that referenced this pull request Oct 27, 2025
…from the iterator back

this also adds a LOT of tests extracted from (which is how I found that bug):
- apache#8697
@rluvaton rluvaton marked this pull request as ready for review October 27, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant