2
RawVec: don't recompute capacity after allocating. by nnethercote · Pull Request...
source link: https://github.com/rust-lang/rust/pull/92220
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.
Currently it sets the capacity to ptr.len() / mem::size_of::<T>()
after any buffer allocation/reallocation. This would be useful if
allocators ever returned a NonNull<[u8]>
with a size larger than
requested. But this never happens, so it's not useful.
Removing this slightly reduces the size of generated LLVM IR, and
slightly speeds up the hot path of RawVec
growth.
r? @ghost
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK