Shell startup times, part 2

March 24, 2008

Following up on Saturday's post and various other blog entries about bash.

While arguing with Anton about bash being slow, I discovered that /etc/bash_completion was sourced twice when starting a shell on my laptop; once in /etc/bash.bashrc, and once in ~/.bashrc. This is Debian bug #430501 - the suggestion there is that /etc/skel/.bashrc should change to check whether /etc/bash_completion had already been included. So, that saves 0.27 seconds.

[email protected]:~$ time bash -i -c exit
exit

real	0m0.270s
user	0m0.240s
sys	0m0.032s

This is still ages when compared to zsh. A solution is proposed in Debian bug #467231 - the functions could be loaded dynamically when they are first used, instead of all at once. I may try this next.

One sandwich and cup of tea later: it works, and bash now beats zsh's time.

[email protected]:~$ time bash -i -c exit
exit

real	0m0.047s
user	0m0.036s
sys	0m0.004s

Nifty tech tag lists fromĀ Wouter Beeftink