put body of function behind Rc for cheaper copy

This commit is contained in:
Moritz Gmeiner 2024-09-03 17:07:29 +02:00
commit 7c4faebf9c
3 changed files with 8 additions and 5 deletions

View file

@ -185,7 +185,7 @@ impl Eval for Expr {
let name = name.clone();
let closure = env.collect_closure(closure_vars);
let param_names = param_names.clone();
let body = body.as_ref().clone();
let body = Rc::new(body.as_ref().clone());
Ok(Value::function(LoxFunction::new(
name,