2

RawVec: don't recompute capacity after allocating. by nnethercote · Pull Request...

 2 years ago
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.

Copy link

Contributor

nnethercote commented 25 days ago

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK