Evaluate function call args more efficiently.

This commit is contained in:
Stephen Chung
2022-01-08 18:40:19 +08:00
parent afb651d0aa
commit f399e8a905
2 changed files with 92 additions and 69 deletions

View File

@@ -229,9 +229,14 @@ impl Engine {
)
} else {
// Normal function call
let (first_arg, args) = args.split_first().map_or_else(
|| (None, args.as_ref()),
|(first, rest)| (Some(first), rest),
);
self.make_function_call(
scope, global, state, lib, this_ptr, name, args, constants, *hashes, pos, *capture,
level,
scope, global, state, lib, this_ptr, name, first_arg, args, constants, *hashes,
pos, *capture, level,
)
}
}