Cache result of brew --prefix

brew --prefix runs Ruby, which is fairly expensive in system startup (somewhere
around 50-100 milliseconds on my machine). Instead of calling it twice, cache
the output and reuse it in the second command
pull/331/head
Kevin Burke 10 years ago
parent f75d01299d
commit 0478c0c2cd

@ -10,8 +10,12 @@ fi
# set homebrew installation paths
if command -v brew &>/dev/null && [[ -d "$(brew --prefix)/share/zsh/site-functions" ]]; then
fpath=("$(brew --prefix)/share/zsh/site-functions" ${fpath})
if command -v brew &>/dev/null; then
# Cache result of brew --prefix once because it is expensive.
local pfx=$(brew --prefix)
if [[ -d "$pfx/share/zsh/site-functions" ]]; then
fpath=("$pfx/share/zsh/site-functions" ${fpath})
fi
fi

Loading…
Cancel
Save