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.
This commit is contained in:
Fabian Boehm 2023-09-09 15:53:20 +02:00
parent 7534572d99
commit fc95eca257

View File

@ -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