feat: lots of optimization
* allocate vm stack on the stack * use Rc instead of Arc * optimize recursive attribute set
This commit is contained in:
@@ -54,14 +54,14 @@ impl<'vm> Func<'vm> {
|
||||
let env = self.env.get().unwrap().clone().released();
|
||||
|
||||
match &self.param {
|
||||
Ident(ident) => env.enter(HashTrieMap::new_sync().insert(ident.clone().into(), arg)),
|
||||
Ident(ident) => env.enter(HashTrieMap::new().insert(ident.clone().into(), arg)),
|
||||
Formals {
|
||||
formals,
|
||||
ellipsis,
|
||||
alias,
|
||||
} => {
|
||||
let arg = arg.unwrap_attr_set();
|
||||
let mut new = HashTrieMap::new_sync();
|
||||
let mut new = HashTrieMap::new();
|
||||
if !ellipsis
|
||||
&& arg
|
||||
.as_inner()
|
||||
@@ -73,11 +73,12 @@ impl<'vm> Func<'vm> {
|
||||
todo!()
|
||||
}
|
||||
for (formal, default) in formals {
|
||||
let formal = formal.clone().into();
|
||||
let arg = arg
|
||||
.select(formal.clone().into())
|
||||
.select(&formal)
|
||||
.or_else(|| default.map(|idx| Value::ThunkRef(vm.get_thunk(idx))))
|
||||
.unwrap();
|
||||
new.insert_mut(formal.clone().into(), arg);
|
||||
new.insert_mut(formal, arg);
|
||||
}
|
||||
if let Some(alias) = alias {
|
||||
new.insert_mut(alias.clone().into(), Value::AttrSet(arg));
|
||||
|
||||
Reference in New Issue
Block a user