From 8b47ea8147120726a049b487d4496b32a6183027 Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Sat, 4 Dec 2021 16:16:59 -0800 Subject: [PATCH] Reserve 1 instead of 4 ProcValue entries for most procs --- crates/dreammaker/src/objtree.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/dreammaker/src/objtree.rs b/crates/dreammaker/src/objtree.rs index 43aefb42..932eb752 100644 --- a/crates/dreammaker/src/objtree.rs +++ b/crates/dreammaker/src/objtree.rs @@ -1097,7 +1097,10 @@ impl ObjectTreeBuilder { code: Option, ) -> Result<(usize, &mut ProcValue), DMError> { let node = &mut self.inner.graph[parent.index()]; - let proc = node.procs.entry(name.to_owned()).or_insert_with(Default::default); + let proc = node.procs.entry(name.to_owned()).or_insert_with(|| TypeProc { + value: Vec::with_capacity(1), + declaration: None, + }); if let Some(kind) = declaration { if let Some(ref decl) = proc.declaration { DMError::new(location, format!("duplicate definition of {}/{}", kind, name))