ShiKaiWi commented on PR #6281:
URL: https://github.com/apache/arrow-rs/pull/6281#issuecomment-2304639895

   The strict benchmark shows `prt::write_byte` + `Vec::set_len` has no 
performance improvement over the `Vec::resize` (actually, the underlying 
implement is just repeating `ptr::write_byte` and then `set_len`).
   
   And to make a conclusion here, there are two implementations:
   - `resize_without_init`: just use `Vec::set_len` to leave some contents in 
the buffer uninitialized, which is UB.
   - `fast_resize`: `prt::write_bytes` and `Vec::set_len`
   
   `resize_without_init` really performs better because the initialization work 
is skipped, but it breaks the safety contract of `Vec::set_len`.
   And `fast_resize` does exactly the same work as `resize`.
   
   I'm going to close this PR. Thanks a lot for guy's advice. @tustvold @alamb 
@Xuanwo @etseidl 


-- 
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]

Reply via email to