-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Common root logic is ignored #23
Comments
zoxide doesn't match on parent directories ajeetdsouza/zoxide#90 zshz doesn't choose shortest directory in some cases agkozak/zsh-z#23 zoxide is faster $ repeat 10 {time (zshz --add /tmp)} ( zshz --add /tmp; ) 0.01s user 0.00s system 75% cpu 0.019 total ( zshz --add /tmp; ) 0.01s user 0.00s system 93% cpu 0.014 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.014 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.016 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.016 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.016 total ( zshz --add /tmp; ) 0.01s user 0.00s system 90% cpu 0.015 total ( zshz --add /tmp; ) 0.01s user 0.00s system 91% cpu 0.016 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.016 total ( zshz --add /tmp; ) 0.01s user 0.00s system 92% cpu 0.015 total $ repeat 10 {time (zoxide add /tmp)} ( zoxide add /tmp; ) 0.00s user 0.00s system 49% cpu 0.009 total ( zoxide add /tmp; ) 0.00s user 0.00s system 73% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 74% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 73% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 72% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 72% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 72% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 71% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 73% cpu 0.004 total ( zoxide add /tmp; ) 0.00s user 0.00s system 74% cpu 0.004 total repeat 10 {time (z /tmp -e > /dev/null)} ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 95% cpu 0.016 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 96% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 95% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 95% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 96% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 96% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 95% cpu 0.013 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 95% cpu 0.013 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 97% cpu 0.014 total ( zshz /tmp -e 2>&1 > /dev/null; ) 0.01s user 0.00s system 96% cpu 0.014 total repeat 10 {time (zq /tmp > /dev/null)} ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 67% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 69% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 73% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 70% cpu 0.003 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 69% cpu 0.003 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 71% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 68% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 69% cpu 0.004 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 74% cpu 0.003 total ( zoxide query /tmp > /dev/null; ) 0.00s user 0.00s system 70% cpu 0.004 total
You're quite right - that is the behavior of The underlying reason is that in the second instance, where you're searching for
there is not really a common root. There would only be a common root if all the matches started with I am working on an alternate way for The new behavior appears to work well, and I've got a number of people testing it out. If it continues to be a success, I'll merge it into the |
Actually, I've decided that the new feature is mature enough to be on the
in your |
Thanks @agkozak I'm using
|
The new, alternate behavior (when you set In your example, if you set If you use the default "common prefix" method, well -- there is no common prefix. You only have a common prefix when all of the possible matches start with the same letters, and the presence of |
OIC thanks for helping me understand! I didn't realise the new logic was applied on top of the scoring. So as you say, with |
When there's a common root, z chooses the shortest matching directory as I expect:
However, the common root logic isn't applied in the following case, which gives the surprising behaviour of choosing the more frequent directory:
I was still expecting
/Users/tekumara/code
to win, despite the addition of the vscode directory.FYI: rupa/z has the same behaviour.
The text was updated successfully, but these errors were encountered: