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/config.rs | |
| parent | a2b27c19dad8b90063b56eff7b6433ba3f390d96 (diff) | |
| parent | 130a32fa7259d348dc3a684b38e688da398c30bb (diff) | |
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/config.rs')
| -rw-r--r-- | src/libsyntax/config.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 5d978b6b9e6..3d9f4a92f81 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -15,7 +15,7 @@ use ast; use source_map::Spanned; use edition::Edition; use parse::{token, ParseSess}; -use OneVector; +use smallvec::SmallVec; use errors::Applicability; use ptr::P; @@ -338,22 +338,23 @@ impl<'a> fold::Folder for StripUnconfigured<'a> { Some(P(fold::noop_fold_expr(expr, self))) } - fn fold_stmt(&mut self, stmt: ast::Stmt) -> OneVector<ast::Stmt> { + fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVec<[ast::Stmt; 1]> { match self.configure_stmt(stmt) { Some(stmt) => fold::noop_fold_stmt(stmt, self), - None => return OneVector::new(), + None => return SmallVec::new(), } } - fn fold_item(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> { + fn fold_item(&mut self, item: P<ast::Item>) -> SmallVec<[P<ast::Item>; 1]> { fold::noop_fold_item(configure!(self, item), self) } - fn fold_impl_item(&mut self, item: ast::ImplItem) -> OneVector<ast::ImplItem> { + fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> + { fold::noop_fold_impl_item(configure!(self, item), self) } - fn fold_trait_item(&mut self, item: ast::TraitItem) -> OneVector<ast::TraitItem> { + fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> { fold::noop_fold_trait_item(configure!(self, item), self) } |
