Replace hasAttr/getAttr calls with the ? and . operators

For NixOS evaluation, this gives a ~21% reduction in the number of
values allocated and a ~4% speedup. It's also more readable.
This commit is contained in:
Eelco Dolstra 2014-10-05 00:03:52 +02:00
parent 0e120dc68f
commit 97220c973f
8 changed files with 51 additions and 55 deletions

View file

@ -62,8 +62,8 @@ rec {
in { result = x.result ++ [entry.text] ++ y.result;
done = y.done;
}
else if hasAttr entry done then f done (tail todo)
else f (done // listToAttrs [{name = entry; value = 1;}]) ([(builtins.getAttr entry predefined)] ++ tail todo);
else if done ? ${entry} then f done (tail todo)
else f (done // listToAttrs [{name = entry; value = 1;}]) ([predefined.${entry}] ++ tail todo);
in (f {} arg).result;
textClosureMap = f: predefined: names: