3 ms·
I have never tried to measure the startup time for interactive bash, because my .bashrc only has a large number of environment variables and of command aliases,
by adrian_b 5y ago
I have never tried to measure the startup time for interactive bash, because my .bashrc only has a large number of environment variables and of command aliases, so I do not see any visible delay at startup.
However I have tried to benchmark bash against zsh, to see if one of them is faster.
The benchmark was inconclusive, because I have tried 2 scripts, but the execution times were essentially the same for both bash and zsh.
The 2 scripts invoked a small shell script on each of about ten thousand files and various file attributes were tested and compared in some shell conditional expressions.
Because the times were the same for bash and zsh, it is likely that the file operations dominated the execution time and not the shell startup time or the script interpretation, as I expected.
The shorter benchmark corresponded to an execution time of about 10 millisecond per shell script, so this is an upper limit for the bash startup time in non-interactive mode on my computer.
It is likely that the startup time was several times less.
In conclusion, the startup of bash in non-interactive mode, when it does not source .bashrc or other scripts, is no more than a few millisecond.
It is clear that someone who wants bash to start fast should be able to reach a startup time much, much less than a second.