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.
|
# `conda_shim` to skip creating shims for those binaries.
|
||||||
build_conda_exclusion_list() {
|
build_conda_exclusion_list() {
|
||||||
shims=()
|
shims=()
|
||||||
shopt -s nullglob
|
for shim in $(sed 's/#.*$//; /^[[:space:]]*$/d' "${BASH_SOURCE%/*}/conda.d/default.list"); do
|
||||||
for shim in $(cat "${BASH_SOURCE%/*}/conda.d/"*".list" | sort -u | sed -e 's/#.*$//' | sed -e '/^[[:space:]]*$/d'); do
|
|
||||||
if [ -n "${shim##*/}" ]; then
|
if [ -n "${shim##*/}" ]; then
|
||||||
shims[${#shims[*]}]="${shim})return 0;;"
|
shims[${#shims[*]}]="${shim})return 0;;"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
shopt -u nullglob
|
|
||||||
eval \
|
eval \
|
||||||
"conda_shim() {
|
"conda_shim() {
|
||||||
case \"\${1##*/}\" in
|
case \"\${1##*/}\" in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user