LLVM is not smart enough to eliminate calls to EcoVec::reserve() even when they are unecessary thanks to earlier calls to EcoVec::reserve() or EcoVec::with_capacity(). This patch elimates them when the ecovec![] macro is used. There may be other unnecessary calls which can be elimated in future patches.
ecovec![1, 2, 3] results in 3 unecessary calls to EcoVec::reserve(). Fixed by forwarding to the From<[T; N]> impl.
ecovec![1; 42] results in 42 unecessary calls to EcoVec::reserve(). Fixed by adding EcoVec::push_unchecked() function for when we know resizing is unnecessary.
Originally, I planned to make a release today so that EcoVec::new constness is available for use through crates.io. If you plan to submit further PRs, I would wait with this.
LLVM is not smart enough to eliminate calls to
EcoVec::reserve()
even when they are unecessary thanks to earlier calls toEcoVec::reserve()
orEcoVec::with_capacity()
. This patch elimates them when theecovec![]
macro is used. There may be other unnecessary calls which can be elimated in future patches.ecovec![1, 2, 3]
results in 3 unecessary calls toEcoVec::reserve()
. Fixed by forwarding to theFrom<[T; N]>
impl.ecovec![1; 42]
results in 42 unecessary calls toEcoVec::reserve()
. Fixed by addingEcoVec::push_unchecked()
function for when we know resizing is unnecessary.