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 01:11:06 +02:00
parent 0e120dc68f
commit 97220c973f
8 changed files with 51 additions and 55 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
let lib = import ./default.nix;
inherit (builtins) getAttr attrNames isFunction;
let
lib = import ./default.nix;
inherit (builtins) attrNames isFunction;
in
rec {
@@ -107,10 +107,10 @@ rec {
outputToAttrListElement = outputName:
{ name = outputName;
value = commonAttrs // {
inherit (builtins.getAttr outputName drv) outPath drvPath type outputName;
inherit (drv.${outputName}) outPath drvPath type outputName;
};
};
outputsList = map outputToAttrListElement outputs;
in builtins.getAttr drv.outputName commonAttrs;
in commonAttrs.${drv.outputName};
}