Open
Description
The following code:
#[inline]
unsafe fn copy_bytes(src: *const u8, dst: *mut u8, count: usize){
for i in 0..count{
*dst.add(i) = *src.add(i);
}
}
is significantly FASTER then ptr::copy_nonoverlapping
, for small count
s, and cases where count
is not known at compile time. (2-3 times for 8 byte copy).
People suggest that this happens, because compiler does not inline copy_nonoverlapping
code:
https://users.rust-lang.org/t/ptr-copy-nonoverlapping-slower-then-manual-per-byte-copy/75588/2?u=tower120
I'm not sure if this is actually a bug though...