alamb commented on a change in pull request #8556:
URL: https://github.com/apache/arrow/pull/8556#discussion_r518934329
##########
File path: rust/arrow/src/compute/kernels/take.rs
##########
@@ -195,15 +217,21 @@ where
let null_slice = null_buf.data_mut();
- let new_values: Vec<T::Native> = (0..data_len)
- .map(|i| {
- let index = indices.value(i) as usize;
- if array.is_null(index) {
- bit_util::unset_bit(null_slice, i);
- }
- array.value(index)
- })
- .collect();
+ let mut new_values: Vec<T::Native> = Vec::with_capacity(data_len);
+ let mut i = 0;
+ while i < data_len {
Review comment:
that makes sense -- it might be worth mentioning that in comments
somewhere (`// use while loop for performance`)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]