kazuyukitanimura commented on code in PR #727:
URL: https://github.com/apache/datafusion-comet/pull/727#discussion_r1698869304
##########
native/core/src/common/bit.rs:
##########
@@ -145,7 +145,9 @@ macro_rules! read_num_be_bytes {
#[inline]
pub fn memcpy(source: &[u8], target: &mut [u8]) {
debug_assert!(target.len() >= source.len(), "Copying from source to target
is not possible. Source has {} bytes but target has {} bytes", source.len(),
target.len());
- target[..source.len()].copy_from_slice(source)
+ // Originally `target[..source.len()].copy_from_slice(source)`
+ // We use the unsafe copy method to avoid some expensive bounds checking/
+ unsafe { std::ptr::copy_nonoverlapping(source.as_ptr(),
target.as_mut_ptr(), source.len()) }
Review Comment:
`copy_from_slice` is `copy_nonoverlapping` with the `if self.len() !=
src.len()` check.
Do you have any benchmark results to show the difference by any chance?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]