Skip to content

Optimize ~/.bashrc.d/* loading time to make new terminals load faster #384

Open
@jankeromnes

Description

@jankeromnes

I added a few date -Ins into a ~/.bashrc on Gitpod, and found that loading all $HOME/.bashrc.d/* scripts:

(echo; echo "for i in \$(ls \$HOME/.bashrc.d/*); do source \$i; done"; echo) >> /home/gitpod/.bashrc

... can take 313ms (sample size = 1)


Adding a few more date -Ins showed me that the longest-running $HOME/.bashrc.d/* scripts could be:

&& { echo; \
echo 'eval "$(pyenv init -)"'; \
echo 'eval "$(pyenv virtualenv-init -)"'; } >> /home/gitpod/.bashrc.d/60-python \

... 109ms (sample size = 1)

&& echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*' >> /home/gitpod/.bashrc.d/70-ruby

... 116ms (sample size = 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions