Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Slow completion



Zsh completion has always been kind of slow for me (in comparison to 
bash) but I always contributed this to the superior functionality (my 
.zshrc is two and a half times as long as my .bashrc).

Today I decided that it had become unbearable and started investigating. 

I tested a simple completion like

    /us<TAB>r/bi<TAB>n/cada<TAB>ver.exe

The directory completion (usr and bin) was already slow but the 
executable (cadaver.exe) took ages.

1. Testing revealed that "setopt path_dirs" was responsible for the slow 
directory completion.

The zshoptions manual page says that path_dirs should not apply in the 
above case[1] but a Process Monitor log showed that Zsh was actually 
searching through the whole executable path.

2. The cause for the even slower executable completion was the following 
line suggested by Bart Schaefer[2]

    zstyle ':completion:*:-command-:*' ignored-patterns '*.dll' '*.exe'

This works fine for a "relative" completion like

    cada<TAB>

where cadaver/and/ cadaver.exe are returned.

But for an "absolute" completion like

    /usr/bin/cada<TAB>

there is only cadaver.exe returned which the above completion style 
ignores. Since _ignored is at the end of my zstyle completer list, this 
results in cadaver.exe only being completed after everything else has 
been tried.

Bash in contrast actually completes

    cada<TAB>

and

    /usr/bin/cada<TAB>

to cadaver with completion_strip_exe set.

I think both issues (path_dirs and inconsistent completion) are actually 
bugs.

Thorsten
[1] "Commands explicitly beginning with `/' [...] are not subject to the 
path search."
[2] http://www.zsh.org/mla/users/2009/msg00391.html



Messages sorted by: Reverse Date, Date, Thread, Author