aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tt
diff options
context:
space:
mode:
authorSimon Vandel Sillesen <[email protected]>2020-05-16 17:24:17 +0100
committerSimon Vandel Sillesen <[email protected]>2020-05-16 21:20:44 +0100
commitb606399095cc5357a93f40fb0d695eab8530bc98 (patch)
treea0e341d8c1f40e6786b578116328135d29911264 /crates/ra_tt
parentef6d53521f07caa9c524749116d5fe53e1e8408d (diff)
Reduce reallocations in ra_tt::buffer::TokenBuffer::new_inner
Diffstat (limited to 'crates/ra_tt')
-rw-r--r--crates/ra_tt/src/buffer.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_tt/src/buffer.rs b/crates/ra_tt/src/buffer.rs
index 14b3f707d..5967f44cd 100644
--- a/crates/ra_tt/src/buffer.rs
+++ b/crates/ra_tt/src/buffer.rs
@@ -42,7 +42,9 @@ impl<'t> TokenBuffer<'t> {
42 buffers: &mut Vec<Box<[Entry<'t>]>>, 42 buffers: &mut Vec<Box<[Entry<'t>]>>,
43 next: Option<EntryPtr>, 43 next: Option<EntryPtr>,
44 ) -> usize { 44 ) -> usize {
45 let mut entries = vec![]; 45 // Must contain everything in tokens and then the Entry::End
46 let start_capacity = tokens.len() + 1;
47 let mut entries = Vec::with_capacity(start_capacity);
46 let mut children = vec![]; 48 let mut children = vec![];
47 49
48 for (idx, tt) in tokens.iter().enumerate() { 50 for (idx, tt) in tokens.iter().enumerate() {