texlive: Use lib.unique for uniqueness checks

In 85605c8a296bd54e9c12e1bd1c33bf1e100d40b7 we got a really nice
performance improvement.

By using this implementation for texlive instantiation RSS is cut by
~2.6x with a similar wall time speedup.
This commit is contained in:
adisbladis 2020-11-24 15:29:28 +01:00
parent fbeebf8b49
commit ce84cc06bf
No known key found for this signature in database
GPG Key ID: 110BFAD44C6249B7

View File

@ -31,13 +31,7 @@ let
++ lib.optional (lib.any pkgNeedsRuby splitBin.wrong) ruby;
};
# TODO: replace by buitin once it exists
fastUnique = comparator: list: with lib;
let un_adj = l: if length l < 2 then l
else optional (head l != elemAt l 1) (head l) ++ un_adj (tail l);
in un_adj (lib.sort comparator list);
uniqueStrings = fastUnique (a: b: a < b);
uniqueStrings = list: lib.sort (a: b: a < b) (lib.unique list);
mkUniqueOutPaths = pkgs: uniqueStrings
(map (p: p.outPath) (builtins.filter lib.isDerivation pkgs));