Skip to content
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

Benefits over z.sh? #12

Closed
zachriggle opened this issue Jan 8, 2020 · 2 comments
Closed

Benefits over z.sh? #12

zachriggle opened this issue Jan 8, 2020 · 2 comments
Assignees

Comments

@zachriggle
Copy link

I see a few Improvements and Fixes at the end of the readme, but it's not clear to me as an end-user why I would use zsh-z over z.sh?

Is it more performant?

@agkozak agkozak self-assigned this Jan 8, 2020
@agkozak
Copy link
Owner

agkozak commented Jan 9, 2020

Thanks for the question. I can see it's time for me to update the documentation.

Yes, performance should probably be the biggest draw. Not having to use all those external commands (awk, sed, date -- actually, I just got rid of the need for mv, rm, and chmod!) and being able to cut down on subshells really speeds things up.

I like to test things out on a slow system where the speed difference matters most. On my eight-year-old Windows 10 desktop running MSYS2, if I load rupa/z and run the benchmark

time ( _z --add /tmp )

it takes, on average 382ms. If I load agkozak/zsh-z and run

time ( zshz --add /tmp )

it takes, on average, 89ms. That's a huge difference.

Now, to be fair, both of those processes normally run in the background, so you won't feel that speed increase directly (but the improvements apply to other areas where the difference is palpable, such as when you invoke z at the command line). A quick comparison of time (z tmp) gives us around 400ms for rupa/z and under 200ms for agkozak/zsh-z.

That brings us to another area of great improvement: stability.

I wanted to see the real difference in the time it takes for the prompt to render, since the biggest drain of any z-like tool is that it has to run every time you hit return. I tried loading each plugin along with romkatv/zsh-prompt-benchmark. It's actually impossible to give you results, though, because running zsh-prompt-benchmark even once trashes the contents of the .z database file. Race conditions have always been a problem with rupa/z; back when I used it, I found that I lost my whole .z file once or twice a year. I've implemented something very similar to what @mafredri proposed a couple of years ago (zsh/system file locking) -- and I can't crash the database anymore, even if I try!

The list of improvements you mention is just that -- I try to resolve bugs and annoyances where I see them. The biggest difference in behavior is my default method of tab completion, which displays the results ranked according to zsh-z's frecency ranking, rather than just alphabetically. I find that makes tab completion really useful -- the directory you're looking for is probably going to be one of the first results.

I'll try to write some of this up and improve the marketing value of my README.md. Thanks so much for bringing the topic up, and be sure to let me know if you have other questions.

@agkozak
Copy link
Owner

agkozak commented Mar 10, 2020

I have updated the documentation to reflect my comments here. I will try to improve this "marketing" aspect of the project as I move along. Thank you for helping to improve ZSH-z

@agkozak agkozak closed this as completed Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants