ulauncher-fzf icon indicating copy to clipboard operation
ulauncher-fzf copied to clipboard

extension is super slow

Open githorse opened this issue 3 years ago • 3 comments

The extension works correctly for me, but there's a 3-5 second delay between typing in the query and seeing the results. If I use fzf on the command line from the same directory with the same query, it's blazingly fast. Help?

githorse avatar Jan 23 '22 18:01 githorse

Hello,

The extension actually searches for files by running the command fd <base_dir> | fzf --filter <query> instead of just running fzf.

The reason for this are:

  • running just fzf will search for files in the directory where the extension is installed in. The only way to specify the directory to be searched is by feeding in the what you want to be searched to fzf. In this case, we use fd
  • I couldnt find a way to interact with fzf's prompt when running it via subprocess, hence the use of --filter I could use another packages such as pyfzf or fzf-wrapper but that would be one extra thing for the users to install.

The extension works quite fast for me so I can only assume it's because you have a large number of files in your system. If you know there are certain files or directories you don't want to be included in your results, you can try using the ignore-file feature. Other than that I'm not sure what else can be done.

I do plan on adding a contributing section in the README, so if you are interested maybe you can investigate this more in your own time.

hillaryychan avatar Jan 24 '22 08:01 hillaryychan

Thanks @hillaryychan -- this definitely seems to be due to the large number of files in my home directory. Unfortunately that does make the extension pretty unusable for me, at least until I do some cleanup :(

After playing with this further I think it's the --filter that's causing the delay, since that filters the entire list before returning anything. If I just run fzf and start typing <query>, it will filter as I type and the result is much faster. Not sure that helps us much here though ...

githorse avatar Jan 24 '22 14:01 githorse

@githorse I've added documentation for development and contributing if you are willing to look into this. Let me know if you have any issues with the steps.

hillaryychan avatar Jan 28 '22 10:01 hillaryychan