mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 01:43:47 +01:00
Set the capacity of the Vec used in gather_captures()
to the number of captures expected (#13339)
# Description Just more efficient allocation during `Stack::gather_captures()` so that we don't have to grow the `Vec` needlessly. # User-Facing Changes Slightly better performance.
This commit is contained in:
parent
ac561b1b0e
commit
f87cf895c2
@ -277,7 +277,7 @@ impl Stack {
|
||||
}
|
||||
|
||||
pub fn gather_captures(&self, engine_state: &EngineState, captures: &[VarId]) -> Stack {
|
||||
let mut vars = vec![];
|
||||
let mut vars = Vec::with_capacity(captures.len());
|
||||
|
||||
let fake_span = Span::new(0, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user