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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to