Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A autojump
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 158
    • Issues 158
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • William Ting
  • autojump
  • Issues
  • #443
Closed
Open
Issue created Sep 27, 2016 by Administrator@rootContributor

slows down zsh startup time considerably

Created by: sodiumjoe

First off, thanks for autojump!

➤  /usr/bin/time /bin/zsh -i -c exit
        0.50 real         0.37 user         0.11 sys

and with autojump commented out of my .zshrc:

➤  /usr/bin/time /bin/zsh -i -c exit
        0.13 real         0.09 user         0.02 sys

most of the time looks like it's spent calling brew and brew --prefix, so I tried:

.zshrc

# [[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
[[ -s /usr/local/etc/profile.d/autojump.sh ]] && . /usr/local/etc/profile.d/autojump.sh

and in /usr/local/share/autojump/autojump.zsh (which is $(brew --prefix)/etc/profile.d/autojump.sh):

# 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})
# fi
if [[ -d "/usr/local/share/zsh/site-functions" ]]; then
    fpath=("/usr/local/share/zsh/site-functions" ${fpath})
fi

and now:

➤  /usr/bin/time /bin/zsh -i -c exit
        0.13 real         0.09 user         0.03 sys

seems like you could:

  1. set an env var on the first brew --prefix
  2. let me set the env var myself and skip the brew --prefix entirely
  3. skip the command -v brew &>/dev/null since presumably it's redundant with brew --prefix
Assignee
Assign to
Time tracking