From d103811173b7b608b2639af61d422736bf715a8e Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 31 Dec 2022 00:58:34 +0100 Subject: [PATCH] lib.isStringLike: Remove use of list In the current implementation of Nix, this list would be allocated over and over. Iirc pennae tried to optimize static list allocation, but gained no significant performance improvement. --- lib/strings.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/strings.nix b/lib/strings.nix index db89f60c480..2188fcb1dbf 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -18,6 +18,7 @@ rec { isInt isList isAttrs + isPath isString match parseDrvName @@ -821,7 +822,8 @@ rec { string interpolations and in most functions that expect a string. */ isStringLike = x: - elem (typeOf x) [ "path" "string" ] || + isString x || + isPath x || x ? outPath || x ? __toString;