#35090 closed defect (fixed)
Running bash_completion script is slow, due to have() function
Reported by: | justin.lebar@… | Owned by: | raimue (Rainer Müller) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.1.1 |
Keywords: | Cc: | ||
Port: | bash-completion |
Description
$ time bash /opt/local/etc/bash_completion real 0m2.954s user 0m0.078s sys 0m0.037s
If I modify the have() function so it returns 0 (instead of running |type|) I get
$ time bash /opt/local/etc/bash_completion real 0m0.245s user 0m0.059s sys 0m0.010s
I'm totally in favor of not loading complex completion scripts for commands that aren't installed, but that doesn't appear to be what's happening here; have() guards only very basic completion for some commands, afaict.
Making opening a new terminal window 10x slower for the sake of avoiding some |complete| calls seems like a premature optimization and a bad trade-off.
Change History (4)
comment:1 Changed 12 years ago by neverpanic (Clemens Lang)
Owner: | changed from macports-tickets@… to raimue@… |
---|
comment:2 Changed 12 years ago by raimue (Rainer Müller)
Status: | new → assigned |
---|
comment:3 Changed 12 years ago by raimue (Rainer Müller)
Port: | bash-completion added |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
bash-completion and bash-completion-devel are now both version 2.0 as of r95135.
Note: See
TracTickets for help on using
tickets.
This is a known issue with bash-completion which is present on all distributions and not only in MacPorts. This will be fixed in bash-completion 2.0, where the loading of scripts will be deferred until they are used the first time.
As of now, bash-completion 2.0 is only available as a development version in MacPorts in the bash-completion-devel port. I will switch bash-completion to version 2.0 in the near future.