Skip to content
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

GH-41: BaseVariableWidthViewVector setZero only if necessary #557

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ViggoC
Copy link
Contributor

@ViggoC ViggoC commented Jan 23, 2025

Closes #41.

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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update in 16c9e2f

Copy link
Member

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.

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Java] VariableWidthViewVectorBenchmarks
3 participants