-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speedup take_boolean / take_bits for non-null indices (~4 - 5x speedup) #2307
Conversation
FYI @jhorstmann this is just brining the special case back (I saw i was discussed a bit here #2064 (comment)). I think for now this might be the easy way forward while we work on making this work more generally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 looks very nice to me
.enumerate() | ||
.try_for_each::<_, Result<()>>(|(i, index)| { | ||
if let Some(index) = index { | ||
let index = ToPrimitive::to_usize(&index).ok_or_else(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to figure out how to use https://docs.rs/arrow/19.0.0/arrow/datatypes/trait.ArrowNativeType.html#method.to_usize here to make the code slightly more pretty, but it wasn't obvious to me 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the pattern occurs quite often. Maybe we can at least reduce the amount of ok_or_else(|| {...
by having this function available (so it becomes something like let index = ToPrimitive::to_usize_or_error(&index)?;
everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps more rust like:
ToPrimitive::try_to_usize(&index)?
Benchmark runs are scheduled for baseline = d56d88e and contender = 4b15b7e. 4b15b7e is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #2306
Rationale for this change
Speedup for (common) case of non-null indices array:
What changes are included in this PR?
Are there any user-facing changes?