kill autocompletion is very slow on macOS #5541
and macOS 10.14
(for some reason fish thinks its 2.7.1 but the commit its built from is ahead of fish 3)
If I type
And then press tab, it takes 3 full seconds before the pager shows up. I think thats way too long. Not sure whats causing this.
The text was updated successfully, but these errors were encountered:
The script relies on https://github.com/fish-shell/fish-shell/blob/72d80c3d91bbd35bed0aafb5514c9834bb48e256/share/functions/__fish_complete_pids.fish for the PIDs.
When I run the second script on its own, its pretty much instant so its not clear to me why the autocomplete for
Double-fixes #5541, by not allowing it to happen.
So, this turned out to be an interesting little problem! The completions weren't nearly as slow for me as they apparently are for you (~200ms as opposed to 3s), but
As it turns out, we define wrapper functions for kill to enable %-expansion, and the wrapper looked like:
function kill --wraps kill command kill (__fish_expand_pid_args $argv) end
See that "--wraps kill" there? That caused fish to set up a wrap-chain, so that each kill would be completed, and then also completed like "kill", which in turn would be completed like itself and then also like "kill", up to 25 times, because that's apparently the maximum depth of a wrap-chain.
(Also, the kill completions could use some love - I strongly suspect that machinery to generate the signals is complete over_kill_ (hehe), and that we might be able to just hardcode the known signals)
The main thing that
One run of it gives me ~180 processes, and takes ~8ms (
It's not all that surprising. Linux is really fricking fast at starting processes! I've had to use a windows (7) machine recently, and git is dog slow there, because it relies heavily on starting processes.
Either that, or you have an older
Our weird %-expanding function wrappers around kill et all defined "--wraps" for the same name. As it turns out, fish follows that one, and executes the completion multiple times. I didn't notice because these tend to be rather quick on linux, but on macOS that's apparently a real issue. Fixes #5541. [ci skip]