You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "maxburke (via GitHub)" <gi...@apache.org> on 2023/03/02 19:39:51 UTC

[GitHub] [arrow-rs] maxburke commented on a diff in pull request #3793: Preallocate buffers for FixedSizeBinary array creation

maxburke commented on code in PR #3793:
URL: https://github.com/apache/arrow-rs/pull/3793#discussion_r1123617125


##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -234,8 +242,10 @@ impl FixedSizeBinaryArray {
     {
         let mut len = 0;
         let mut byte = 0;
-        let mut null_buf = MutableBuffer::from_len_zeroed(0);
-        let mut buffer = MutableBuffer::from_len_zeroed(0);
+
+        let iter_size_hint = iter.size_hint().0;
+        let mut null_buf = MutableBuffer::from_len_zeroed((iter_size_hint + 7) / 8);

Review Comment:
   Done



##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -141,8 +141,11 @@ impl FixedSizeBinaryArray {
         let mut len = 0;
         let mut size = None;
         let mut byte = 0;
-        let mut null_buf = MutableBuffer::from_len_zeroed(0);
+
+        let iter_size_hint = iter.size_hint().0;
+        let mut null_buf = MutableBuffer::from_len_zeroed((iter_size_hint + 7) / 8);

Review Comment:
   Done



-- 
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