lidavidm commented on code in PR #557:
URL: https://github.com/apache/arrow-java/pull/557#discussion_r1928063266


##########
vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthViewVector.java:
##########
@@ -1367,11 +1367,13 @@ protected ArrowBuf allocateOrGetLastDataBuffer(int 
length) {
   protected final void setBytes(int index, byte[] value, int start, int 
length) {
     int writePosition = index * ELEMENT_SIZE;
 
-    // to clear the memory segment of view being written to
-    // this is helpful in case of overwriting the value
-    viewBuffer.setZero(writePosition, ELEMENT_SIZE);
-
     if (length <= INLINE_SIZE) {
+      // to clear the memory segment of view being written to
+      // if it has been set
+      if (viewBuffer.getLong(writePosition) != 0 || 
viewBuffer.getLong(writePosition + 8) != 0) {

Review Comment:
   So the basic effect is that if the view buffer is all 0, we skip setting it 
back to 0? And basically, for freshly allocated memory, this skips a redundant 
memset? Can we explain it a little more in the comment?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to