Speed up FnPtr::call when there is a linked scripted function.

This commit is contained in:
Stephen Chung
2022-12-11 16:55:30 +08:00
parent 91f149270a
commit 1f815f995f
6 changed files with 186 additions and 268 deletions

View File

@@ -3798,7 +3798,8 @@ impl Engine {
comments: Box::default(),
});
let fn_ptr = crate::FnPtr::from(script.clone());
let mut fn_ptr = crate::FnPtr::new_unchecked(fn_name, StaticVec::new_const());
fn_ptr.set_fn_def(Some(script.clone()));
let expr = Expr::DynamicConstant(Box::new(fn_ptr.into()), settings.pos);
#[cfg(not(feature = "no_closure"))]