-
Notifications
You must be signed in to change notification settings - Fork 95
GH-41: BaseVariableWidthViewVector setZero only if necessary #557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's redundant to setZero if the data is already zero. Checking will introduce some overhead, but it is much smaller than that of setMemory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update in 16c9e2f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to check only these positions? IIUC, ZERO is a valid value to be set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if all 16 bytes are 0, there is no need to set them to 0 again, I think is the point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wgtmac are we on the same page here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it sounds good.
Closes #41.