Speed up bash starting time (slow scripts in profile.d, /etc/bash_completion.d)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

once in a while I get annoyed at how slow bash is to startup; using a
tiling wm poping a new shell is supposed to be quite fast but I'm
staring at a new empty window for ~1s everytime and it gets annoying...

According to https://xkcd.com/1205/ wasting 1s 50+ times a day is worth
spending some time to try to improve it so let's see what we can do :)


Here's the baseline on my machine:
$ time bash -l < /dev/null

real	0m0.341s
user	0m0.198s
sys	0m0.146s


And a few low hanging fruits I could find adding `-x 2>&1 | ts "%.s"`:
 - down to 0.288s after removing /etc/profile.d/flatpak.sh
(flatpak-1.6.3-1.fc32.x86_64)

 - down to 0.225s after removing /etc/profile.d/modules.sh
(environment-modules-4.4.1-2.fc32.x86_64)

 - down to 0.130s after moving /etc/bash_completion.d/* to
/usr/share/bash-completion/completions/
This one is not actually a no-op: bash-completion loads things from /etc
at shell startup time, but things in /usr at first tab time, so if the
file in /usr/share is not named by the same prefix as the command it
help completes it won't work anymore, but in most case here it will
still work just the same (slightly slower on first use)

Here's the list of files I had in there and their packages:
authselect-completion.sh authselect-1.2.1-1.fc32.x86_64
fcoeadm fcoe-utils-1.0.32-9.git9834b34.fc31.x86_64
javaws.bash icedtea-web-2.0.0-pre.0.2.alpha13.patched1.fc32.x86_64
perf perf-5.6.7-300.fc32.x86_64
trace-cmd.bash trace-cmd-2.8.3-1.fc32.x86_64
bpftool bpftool-5.6.7-300.fc32.x86_64
fcoemon fcoe-utils-1.0.32-9.git9834b34.fc31.x86_64
policyeditor.bash icedtea-web-2.0.0-pre.0.2.alpha13.patched1.fc32.x86_64
xl.sh xen-runtime-4.13.0-7.fc32.x86_64
cargo cargo-1.43.1-1.fc32.x86_64
fzf fzf-0.21.1-1.fc32.x86_64
lilv lilv-0.24.6-2.fc32.x86_64
python-argcomplete.sh python3-argcomplete-1.10.0-4.fc32.noarch
dbus-bash-completion.sh dbus-glib-devel-0.110-7.fc32.x86_64
gluster glusterfs-cli-7.5-1.fc32.x86_64
lldpad lldpad-1.0.1-16.git036e314.fc32.x86_64
redefine_filedir bash-completion-2.8-8.fc32.noarch
dog sheepdog-1.0.1-10.fc31.x86_64
itweb-settings.bash icedtea-web-2.0.0-pre.0.2.alpha13.patched1.fc32.x86_64
lldptool lldpad-1.0.1-16.git036e314.fc32.x86_64
torsocks torsocks-2.3.0-5.fc32.x86_64


341 to 130ms is a good start I guess, the rest of the waiting time
probably now outweights bash and will get some looking at at a later
point, but might as well start somewhere.

How should I go about with that? Open bz bugs to all the packages I
listed? strongly suggesting to get things to move to /usr/share (17) and
flatpak (suggest some kind of cache? not sure they'll be interested...)
and environment-modules (not sure what to suggest there, I only have
environment-modules because I need to test something with openmpi from
time to time and it comes with it...)


It might also make sense to have a packaging guideline suggesting to
avoid /etc/bash_completion.d in favor of the /usr/share variant, I
couldn't find anything here[1] but I might not have looked thoroughly
enough...
[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/


Would anyone be willing to help, something is telling me that doing this
alone would take more time than what I'd save in the end, but a few
people considering it'll help everyone might be ;)


Thanks!
-- 
Dominique
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux