mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
* Prevent repeated wrapping of closed terms
(closed(closed(closed(...)))) since this reduces performance by producing bigger terms and killing caching (which incidentally also prevents useful infinite recursion detection).
This commit is contained in:
parent
2135e7c041
commit
0f827cc607
1 changed files with 6 additions and 1 deletions
|
@ -233,7 +233,12 @@ Expr substitute(const ATermMap & subs, Expr e)
|
|||
|
||||
if (matchVar(e, name)) {
|
||||
Expr sub = subs.get(name);
|
||||
return sub ? makeClosed(sub) : e;
|
||||
Expr wrapped;
|
||||
/* Add a "closed" wrapper around terms that aren't already
|
||||
closed. The check is necessary to prevent repeated
|
||||
wrapping, e.g., closed(closed(closed(...))), which kills
|
||||
caching. */
|
||||
return sub ? (matchClosed(sub, wrapped) ? sub : makeClosed(sub)) : e;
|
||||
}
|
||||
|
||||
/* In case of a function, filter out all variables bound by this
|
||||
|
|
Loading…
Reference in a new issue