perf: faster execution of build_conda_exclusion_list
1) Got rid of useless call to `cat`, much better to simply use sed with file as argument. 2) Got rid of `sort -u`. There is no need to sort the list. Additionally, the list `pyenv.d/rehash/conda.d/default.list` only has unique entries, and even if you have duplicate entries, the function will still work. --> No need for sort nor unique. 3) Further improvement is simple, save a cached cleaned-list-v1.0 in `conda.d` and simple read from that file instead of doing `sed`, which must be a more expensive operation than simply reading from file.
This commit is contained in:
parent
ab2a5ad030
commit
8e5379ebe3
@ -18,13 +18,11 @@ if conda_exists; then
|
||||
# `conda_shim` to skip creating shims for those binaries.
|
||||
build_conda_exclusion_list() {
|
||||
shims=()
|
||||
shopt -s nullglob
|
||||
for shim in $(cat "${BASH_SOURCE%/*}/conda.d/"*".list" | sort -u | sed -e 's/#.*$//' | sed -e '/^[[:space:]]*$/d'); do
|
||||
for shim in $(sed 's/#.*$//; /^[[:space:]]*$/d' "${BASH_SOURCE%/*}/conda.d/default.list"); do
|
||||
if [ -n "${shim##*/}" ]; then
|
||||
shims[${#shims[*]}]="${shim})return 0;;"
|
||||
fi
|
||||
done
|
||||
shopt -u nullglob
|
||||
eval \
|
||||
"conda_shim() {
|
||||
case \"\${1##*/}\" in
|
||||
|
Loading…
x
Reference in New Issue
Block a user