diff options
| author | bors <bors@rust-lang.org> | 2018-09-26 10:04:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-26 10:04:42 +0000 |
| commit | c3a1a0d3400bbbcac194efb6ef2b14eef9be5149 (patch) | |
| tree | 0a75f20d6c5a9def5008fd24194e83946f9ac9db /src/libsyntax/ext/source_util.rs | |
| parent | a2b27c19dad8b90063b56eff7b6433ba3f390d96 (diff) | |
| parent | 130a32fa7259d348dc3a684b38e688da398c30bb (diff) | |
| download | rust-c3a1a0d3400bbbcac194efb6ef2b14eef9be5149.tar.gz rust-c3a1a0d3400bbbcac194efb6ef2b14eef9be5149.zip | |
Auto merge of #53824 - ljedrz:begone_onevector, r=michaelwoerister
Remove OneVector, increase related SmallVec capacities Removes the `OneVector` type alias (equivalent to `SmallVec<[T; 1]>`); it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins (due to spilling to the heap) expected when using `SmallVec` instead of `Vec`. The numbers I used in this PR are very rough estimates - it would probably be a good idea to adjust some/all of them, which is what this proposal is all about. It might be a good idea to additionally create some local type aliases for the `SmallVec`s in the `Folder` trait, as they are repeated in quite a few spots; I'd be happy to apply this sort of adjustments.
Diffstat (limited to 'src/libsyntax/ext/source_util.rs')
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index e4b9e3216b1..f5d1bd6255e 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -17,7 +17,7 @@ use parse::{token, DirectoryOwnership}; use parse; use print::pprust; use ptr::P; -use OneVector; +use smallvec::SmallVec; use symbol::Symbol; use tokenstream; @@ -110,9 +110,9 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T fn make_expr(mut self: Box<ExpandResult<'a>>) -> Option<P<ast::Expr>> { Some(panictry!(self.p.parse_expr())) } - fn make_items(mut self: Box<ExpandResult<'a>>) - -> Option<OneVector<P<ast::Item>>> { - let mut ret = OneVector::new(); + + fn make_items(mut self: Box<ExpandResult<'a>>) -> Option<SmallVec<[P<ast::Item>; 1]>> { + let mut ret = SmallVec::new(); while self.p.token != token::Eof { match panictry!(self.p.parse_item()) { Some(item) => ret.push(item), |
