-
Notifications
You must be signed in to change notification settings - Fork 33
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
Make into_arrow truly zero-copy, rewrite DataFusion operators #451
Conversation
Before we would go through the ArrowBuffer::from(&[u8]) constructor, which would actually do a full data copy. Now we're just doing pointer tricks. Shaved about 30ms (~7%) off of the tpc-h benchmark.
data.into(), | ||
nulls, | ||
)), | ||
PType::I32 => Arc::new(unsafe { |
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.
I'm not sure how much this actually saves us, once I get to ~parity with arrow numbers I'll turn the validations back on and see what difference it makes
I'm using this as a more general improve-the-benchmarks PR, found a few more allocations and rewriting the vortex memory scan exec, should have something ready to ship later this morning |
f.debug_struct("VortexScanExec") | ||
.field("array_length", &self.array.len()) | ||
.field("array_dtype", &self.array.dtype()) | ||
.field("scan_projection", &self.scan_projection) | ||
.field("plan_properties", &self.plan_properties) | ||
.finish_non_exhaustive() | ||
} |
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.
I went with custom impl because Array
logs the entire buffer contents as part of its Debug
impl
Stdlib has a gated unstable feature to log a field using the contents of a closure, so in the future you'd be able to do something like
f.debug_struct("VortexScanExec")
.field_with("array_length", |mut f| {
f.debug_struct("Array")
.field("length", &self.array.len())
.field("dtype", self.array.dtype())
.finish()
})
https://doc.rust-lang.org/std/fmt/struct.DebugStruct.html#method.field_with
Before we would go through the ArrowBuffer::from(&[u8]) constructor, which would actually do a full data copy.
Now we're just doing pointer tricks. Shaved about 30ms (~7%) off of the tpc-h benchmark.