Optimized implementation for `from_header_and_slice`
vkrasnov opened this issue · 1 comments
vkrasnov commented
In my code I use ThinArc<(), u8>
a lot, and apparently the compiler can't optimize the iterator in from_header_and_iter
away. It really does iterate over each byte and writes it using ptr::write
. I implemented an optimization that accepts a whole slice of a Copy
type and uses ptr::copy_nonoverlapping
instead, and I got a 5% speedup in my application. I can open a PR if there is interest.
Manishearth commented
That seems useful, yes