-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
speed up ssh completion #4377
Comments
So.... there's a bunch of stuff we can do here. Some is general and requires a bunch of work, some is specific to the ssh completion script and the The biggest one is this: complete -x -c ssh -d Hostname -a "
(__fish_print_hostnames)
(
# Prepend any username specified in the completion to the hostname
echo (commandline -ct)|sed -ne 's/\(.*@\).*/\1/p'
)(__fish_print_hostnames)
" That actually calls For more improvement, we need profiling. Fortunately fish has that built-in. Unfortunately it's not accessible from inside a running session, so this will include fish's startup time (and yes, we have issues open about that). It will also include an error since the On my system, about 90% of the time spent in @ThomasAH: Please run |
Interesting ... Full profile attached. There is nothing private in it, the only information that some people might consider private is the location of my home directory and that I use fish's vi mode :) Edit: It seems I can't attach the profile here. Here is the output of
|
Okay, so:
Anyway, I'm going to open a PR any minute now that could possibly improve stuff somewhat. |
Yes, I'm running fish 2.6.0 (Debian jessie using your OBS packages). |
I've tested @ThomasAH's awk script from #4378 under FreeBSD with the BSD I've merged it into both master and 2.7.0 |
My solution to problem works like a charm: domas.zelionis@eng ~> cat /etc/hosts_for_fish |wc -l domas.zelionis@eng ~> date --iso-8601=ns ;__fish_print_hostnames > /dev/null;date --iso-8601=ns; root@eng:/usr/share/fish/functions$cat /usr/share/fish/functions/__fish_print_hostnames.fish function __fish_print_hostnames -d "Print a list of known hostnames"
|
A wish list entry as discussed in issue #4374:
Completion of ssh hostnames in fish 2.6 and current git master becomes slower when many host names are available in known_hosts (and possibly ~/.ssh/config)
In my case:
Most entries have one or more IPs in addition to hostnames, some have multiple hostnames.
Some hosts are listed twice due to multiple public keys (e.g. ssh-rsa and ssh-ed25519).
~/.ssh/config has multiple entries (some with multiple hostnames), too:
Timing is done with:
time fish -c __fish_print_hostnames >/dev/null
Which yields 0.32s (best of multiple runs) on Intel Xeon CPU E5-2620 @ 2.10GHz
and 0.51s on AMD Opteron 2352.
For comparison: bash performs completion here without any noticeable delay.
The text was updated successfully, but these errors were encountered: