From 16da3e9b3b5d247c37a6c378058eba3231c58f7f Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 26 Feb 2022 20:25:07 +0000 Subject: [PATCH] Improve performance of function processing --- lib/src/sql/function.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/sql/function.rs b/lib/src/sql/function.rs index 4af690a4..0110d790 100644 --- a/lib/src/sql/function.rs +++ b/lib/src/sql/function.rs @@ -55,10 +55,9 @@ impl Function { fnc::cast::run(ctx, s, a) } Function::Normal(ref s, ref e) => { - let mut a: Vec = vec![]; + let mut a: Vec = Vec::with_capacity(e.len()); for v in e { - let v = v.compute(ctx, opt, txn, doc).await?; - a.push(v); + a.push(v.compute(ctx, opt, txn, doc).await?); } fnc::run(ctx, s, a).await }