Don't allocate empty lists
This saves about 4 MB when evaluating a NixOS system configuration.
This commit is contained in:
parent
3e89ef597c
commit
e5c589d271
1 changed files with 1 additions and 1 deletions
|
@ -348,7 +348,7 @@ void EvalState::mkList(Value & v, unsigned int length)
|
||||||
{
|
{
|
||||||
v.type = tList;
|
v.type = tList;
|
||||||
v.list.length = length;
|
v.list.length = length;
|
||||||
v.list.elems = (Value * *) GC_MALLOC(length * sizeof(Value *));
|
v.list.elems = length ? (Value * *) GC_MALLOC(length * sizeof(Value *)) : 0;
|
||||||
nrListElems += length;
|
nrListElems += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue