-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improve zf’s speed #46
Comments
Hi @Brixy! I think this is closely related to #38 What you are seeing here is zf blocks until all of stdin has been read, while fzf immediately shows the UI and incrementally reads from stdin. Until recently (8ddc8fd) zf didn't have an easy way to read stdin in increments like fzf. But now that I added an event loop this is solvable. So this issue is on my radar. I'm not sure when I'll add it, but it is something I plan to fix. Just to double check, you aren't experiencing zf itself being slow after it loads right? |
Hi! Thanks for your response. My impression is that this could be zf related. The times mentioned for fzf are fzf’s startup time + fd/find search, that is the times for
After zf has loaded it is very fast and responsive. Thank you! |
I think we are on the same page, but I'm going to share this just to make sure In the bottom left of fzf it shows a counter increasing as it reads the lines from stdin. The difference between zf and fzf is that zf doesn't display the UI until all lines are loaded, but fzf allows using the UI while the lines are read. So in my experience fzf and zf take roughly the same amount of time to read all the lines, but fzf has a UI open faster I'm planning on changing zf to match fzf's behavior here.
Happy to hear this! Thank you for the kind words |
Yes, I get what you mean. (Sorry if I am not precise enough. English is not my mother tongue.) For my setup loading fzf plus fzf’s reading from stdin takes about 200 milliseconds, that includes the time the counter needs to finish.
I have suspected that because you asked back 😀. In my case zf takes a lot longer to load which is surprising because the actual search is done by e.g. As a precaution I just used the find command from your .gif file:
I’ll try to compile zf from the current branch or wait for a new release and give feedback then. Thanks for your work and patience! |
Your English is great! I couldn't tell :)
I'm glad I asked more. This is strange, because all zf is doing is splitting the input on
Nothing meaningful for reading from stdin has changed since 0.8.0, so you shouldn't need to try a different version. Also zf master isn't super stable at the moment as I add some new features ... |
hi I just found out about zf a couple of days ago and been using it more than fzf. I love how the fuzzy finder logic finds the files I'm looking for more often without trial and error different keywords. Also I've been wondering about the performance aspect of zf...and I think there has been major improvements in speed? just now I tested a directory with 170k files: a smaller directory with 8k files: |
Dear Nathan,
thank you very much for this excellent tool. I would like to switch to
zf
fromfzf
.As
fzf
feels faster and snappier, I did some very basic benchmark testing. Here’s the results:time find -type f | zf
: 2.29 secs (~300,000 files)time find -type f | fzf
: 170.00 millis (~300,000 files)time fd -t f | zf
: 1.84 secs (~128,000 files)time fd -t f | fzf
: 725.22 millis (~128,000 files)Can/will this be adressed?
Thank you very much.
Background:
Tested with zf 0.8.0 on Void Linux with fish shell. (Experienced some problems building zf from source as I am just slowly digging into zig.)
Also tested with
-k -p
flags.I always work from
~/
. That’s why I always search many files. This is what I have been using for years within a little POSIX script:fd --type file --max-depth 1 && fd --type file --min-depth 2 | fzf
.The text was updated successfully, but these errors were encountered: