kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
795 stars 36 forks source link

Slow to complete with large list #20

Open glucas opened 5 years ago

glucas commented 5 years ago

If I call fzf directly at the root of a deep directory tree (for example), I can choose a match and immediately exit without waiting for the full set of available files to be listed.

Doing the same with Invoke-Fzf seems to accept my match, but then I sit waiting with an empty screen for a while before I can do anything with the result. I assume it is waiting for the input set to finish building, but if I already found what i want is there a way to bail out like with fzf directly?

kelleyma49 commented 5 years ago

I can recreate this is by calling Invoke-Fzf directly. Ctrl+t doesn't seem to exhibit this behavior.

I've seen cases in the past where Ctrl+c don't bubble up to Powershell, but I haven't been able to figure out why. I'll continue to investigate.

redactedscribe commented 1 year ago

invoke-Fzf vs Ctrl+T: The former is still slow compared to the latter. I've got little experience with both fzf and PSFzf so I'm not sure how expected this is, but it doesn't seem right on the surface.

From a root folder on one of my drives: invoke-Fzf: 8 seconds, returns 305k items. Ctrl+T: ~1 second, returns 279k items.

fzf 0.37.0 PSFzf 2.5.16 PowerShell 7.3.2 Windows 11 22H2

stinos commented 1 year ago

I've got little experience with both fzf and PSFzf so I'm not sure how expected this is, but it doesn't seem right on the surface

It is expected, because of a couple of reasons. I'm briefly touching on the subject here (3rd bullet point): https://github.com/stinos/PsFzfLite#rationale-and-helper-functions. In short: fzf uses pretty fast multithreaded file walking under the hood whereas (depending on what exactly is being searched, IIRC) PsFzf falls back to Powershell or cmd-based dir-like functions which are a lot slower. Plus fzfz filters more items out. And on top of that there's overhead from piping items around in PS.

redactedscribe commented 1 year ago

It is expected, because of a couple of reasons. I'm briefly touching on the subject here (3rd bullet point): https://github.com/stinos/PsFzfLite#rationale-and-helper-functions.

Thanks for the explanation and the link to your repo. I'm just testing PsFzfLite and it does perform better in the case that I outlined. Looks like I'll be using that instead.