You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "eerhardt (via GitHub)" <gi...@apache.org> on 2023/04/15 13:12:46 UTC

[GitHub] [arrow] eerhardt commented on a diff in pull request #13810: ARROW-17330: [C#] Extend ArrowBuffer.BitmapBuilder to improve performance of array concatenation

eerhardt commented on code in PR #13810:
URL: https://github.com/apache/arrow/pull/13810#discussion_r1167539929


##########
csharp/src/Apache.Arrow/ArrowBuffer.BitmapBuilder.cs:
##########
@@ -69,7 +70,7 @@ public BitmapBuilder(int capacity = DefaultBitCapacity)
                 Memory = new byte[BitUtility.ByteCount(capacity)];
                 Capacity = capacity;
             }
-
+                        

Review Comment:
   (nit) Please revert the unintentional whitespace change here.



##########
csharp/src/Apache.Arrow/Arrays/PrimitiveArrayBuilder.cs:
##########
@@ -141,15 +141,17 @@ public TBuilder Append(ReadOnlySpan<T> span)
         {
             int len = ValueBuffer.Length;
             ValueBuffer.Append(span);
-            ValidityBuffer.AppendRange(Enumerable.Repeat(true, ValueBuffer.Length - len));
+            int additionalBitsCount = ValueBuffer.Length - len;
+            ValidityBuffer.Reserve(additionalBitsCount).AppendRange(Enumerable.Repeat(true, additionalBitsCount));

Review Comment:
   @westonpace has the right idea above. Add a method to the ValidityBuffer that adds  the same `bool` value `length` times without allocating an `Enumerable.Repeat` object.



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