11
Github Avoid unnecessary Vec construction in BufReader by calebsander · Pull Req...
source link: https://github.com/rust-lang/rust/pull/82728
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
As mentioned in #80460, creating a Vec
and calling Vec::into_boxed_slice()
emits unnecessary calls to realloc()
and free()
. Updated the code to use Box::new_uninit_slice()
to create a boxed slice directly. I think this also makes it more explicit that the initial contents of the buffer are uninitialized.
r? @m-ou-se
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK