From fc95eca25774f742aee6ad09370a2f6f913d2044 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 9 Sep 2023 15:53:20 +0200 Subject: [PATCH] share/config.fish: Skip __fish_set_locale if $LANG is already set This is the most common and sensible env var, we check it outside, so we can skip loading the function at all if we already know it's not gonna do anything. This is done on every startup of every single fish, and it saves ~0.2ms. --- share/config.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/config.fish b/share/config.fish index afa2510f6..69c7d56eb 100644 --- a/share/config.fish +++ b/share/config.fish @@ -150,7 +150,8 @@ end # Set the locale if it isn't explicitly set. Allowing the lack of locale env vars to imply the # C/POSIX locale causes too many problems. Do this before reading the snippets because they might be # in UTF-8 (with non-ASCII characters). -__fish_set_locale +not set -q LANG # (fast path - no need to load the file if we have $LANG) +and __fish_set_locale # # Some things should only be done for login terminals