tustvold commented on a change in pull request #6980:
URL: https://github.com/apache/arrow/pull/6980#discussion_r413987657



##########
File path: rust/arrow/src/array/builder.rs
##########
@@ -236,6 +251,14 @@ impl<T: ArrowPrimitiveType> BufferBuilderTrait<T> for 
BufferBuilder<T> {
         self.write_bytes(v.to_byte_slice(), 1)
     }
 
+    default fn append_n(&mut self, n: usize, v: T::Native) -> Result<()> {
+        self.reserve(n)?;
+        for _ in 0..n {
+            self.write_bytes(v.to_byte_slice(), 1)?;
+        }

Review comment:
       When unoptimised both forms contain a checked_add, it is just hard to 
see as the foreach+closure isn't inlined, and the codegen for the iterator form 
is significantly worse in general. When optimised the codegen is identical for 
both forms.
   
   Given this, I'm inclined to optimise for readability and use the simpler 
form, but ultimately it is up to you as the maintainers :)




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to