diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-03-28 12:27:26 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-03-29 09:32:58 +1100 |
| commit | 17a8aff20abdef46ae90801c85cc232e81443e1b (patch) | |
| tree | fdc560f228255949dae032b2f28409dbdf991580 /src/libsyntax/parse | |
| parent | 4c27fb19ba15a2e45485e601a79914c6280196b0 (diff) | |
| download | rust-17a8aff20abdef46ae90801c85cc232e81443e1b.tar.gz rust-17a8aff20abdef46ae90801c85cc232e81443e1b.zip | |
Use `SmallVec` in `TokenStreamBuilder`.
This reduces by 12% the number of allocations done for a "clean incremental" of `webrender_api`, which reduces the instruction count by about 0.5%. It also reduces instruction counts by up to 1.4% across a range of rustc-perf benchmark runs.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 4211268f33e..e99a86e807f 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -6,6 +6,7 @@ use crate::parse::parser::{Parser, TokenType, PathStyle}; use crate::tokenstream::{TokenStream, TokenTree}; use log::debug; +use smallvec::smallvec; #[derive(Debug)] enum InnerAttributeParsePolicy<'a> { @@ -171,7 +172,7 @@ impl<'a> Parser<'a> { } else { self.parse_unsuffixed_lit()?.tokens() }; - TokenStream::from_streams(vec![eq.into(), tokens]) + TokenStream::from_streams(smallvec![eq.into(), tokens]) } else { TokenStream::empty() }; |
