Improve performance of function processing

This commit is contained in:
Tobie Morgan Hitchcock 2022-02-26 20:25:07 +00:00
parent ec698e85de
commit 16da3e9b3b

View file

@ -55,10 +55,9 @@ impl Function {
fnc::cast::run(ctx, s, a) fnc::cast::run(ctx, s, a)
} }
Function::Normal(ref s, ref e) => { Function::Normal(ref s, ref e) => {
let mut a: Vec<Value> = vec![]; let mut a: Vec<Value> = Vec::with_capacity(e.len());
for v in e { for v in e {
let v = v.compute(ctx, opt, txn, doc).await?; a.push(v.compute(ctx, opt, txn, doc).await?);
a.push(v);
} }
fnc::run(ctx, s, a).await fnc::run(ctx, s, a).await
} }