summary refs log tree commit diff
path: root/lib/strings-with-deps.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-05 00:03:52 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-10-05 01:11:06 +0200
commit97220c973fdc6d3cfa02fe597c4301e87177603c (patch)
treec208a98c5a45a9700b8c56775e69542ef7fba44f /lib/strings-with-deps.nix
parent0e120dc68f7de02ccb22df27fd15835fc6d082a4 (diff)
downloadnixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar.gz
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar.bz2
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar.lz
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar.xz
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.tar.zst
nixpkgs-97220c973fdc6d3cfa02fe597c4301e87177603c.zip
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.
Diffstat (limited to 'lib/strings-with-deps.nix')
-rw-r--r--lib/strings-with-deps.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strings-with-deps.nix b/lib/strings-with-deps.nix
index 3ad3e599150..bdcc25cbd20 100644
--- a/lib/strings-with-deps.nix
+++ b/lib/strings-with-deps.nix
@@ -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: