You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/29 17:07:00 UTC

[GitHub] [arrow-rs] jhorstmann commented on a diff in pull request #1048: Optimized sorting for ordered dictionaries

jhorstmann commented on code in PR #1048:
URL: https://github.com/apache/arrow-rs/pull/1048#discussion_r884299732


##########
arrow/src/compute/kernels/sort.rs:
##########
@@ -151,8 +152,16 @@ fn partition_validity(array: &ArrayRef) -> (Vec<u32>, Vec<u32>) {
         // faster path
         0 => ((0..(array.len() as u32)).collect(), vec![]),
         _ => {
-            let indices = 0..(array.len() as u32);
-            indices.partition(|index| array.is_valid(*index as usize))
+            let validity = array.data().null_buffer().unwrap();

Review Comment:
   Noticed this as a hotspot while profiling. The `is_valid` function does not seem to get inlined and contains a branch, and we can also initialize both vectors with the right capacities.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org