Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #206 - hiddenhare:inline-constructors, r=mbrubeck
Add #[inline] attribute to all fns which return SmallVec When rustc fails to inline a `SmallVec` constructor, it can carry a significant performance cost: for example, if `SmallVec::<[i64; 128]>::from_iter(...)` fails to inline, it will perform an unnecessary 1kb memcpy. I've recently been bitten by this when using `SmallVec` in a context where rustc seemed to be reluctant to perform inlining (a large fn with nested closures). Switching from `SmallVec::from_iter` to `SmallVec::new` and `push`, with a buffer size of 256 bytes, saved over 20ns per call. For larger buffers, `from_iter` carried a proportionally higher cost, even when the actual capacity in use didn't change.
- Loading branch information