summary refs log tree commit diff
path: root/pkgs/shells
diff options
context:
space:
mode:
authorBouke van der Bijl <i@bou.ke>2020-06-17 18:59:35 +0200
committerBouke van der Bijl <i@bou.ke>2020-06-17 18:59:35 +0200
commit9daa1838d3d06fda9a5aee03738e677d7a5837ba (patch)
treed0115476909de214600f973d0dd7ebbf2ea23bde /pkgs/shells
parent9d0c3ffe6783d59b427d018e8341e0084737fde9 (diff)
downloadnixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar.gz
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar.bz2
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar.lz
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar.xz
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.tar.zst
nixpkgs-9daa1838d3d06fda9a5aee03738e677d7a5837ba.zip
fish: replace use of tr with string split
This shaves about 4ms off fish start time.

Before (profiled with 'fish --profile prof.txt -c fish_prompt'):

225	4636	----> set -l __nix_profile_paths (echo $NIX_PROFILES | /nix/store/m5ajgnzp2512na31brwfmydwk3l1gawb-coreutils-8.31/bin/tr ' ' '\n')[-1..1]
4411	4411	-----> echo $NIX_PROFILES | /nix/store/m5ajgnzp2512na31brwfmydwk3l1gawb-coreutils-8.31/bin/tr ' ' '\n'

After:

190	248	----> set -l __nix_profile_paths (string split ' ' $NIX_PROFILES)[-1..1]
Diffstat (limited to 'pkgs/shells')
-rw-r--r--pkgs/shells/fish/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix
index 11d9e48008f..57c52a411d3 100644
--- a/pkgs/shells/fish/default.nix
+++ b/pkgs/shells/fish/default.nix
@@ -79,7 +79,7 @@ let
 
       # additional profiles are expected in order of precedence, which means the reverse of the
       # NIX_PROFILES variable (same as config.environment.profiles)
-      set -l __nix_profile_paths (echo $NIX_PROFILES | ${coreutils}/bin/tr ' ' '\n')[-1..1]
+      set -l __nix_profile_paths (string split ' ' $NIX_PROFILES)[-1..1]
 
       set __extra_completionsdir \
         $__nix_profile_paths"/etc/fish/completions" \