mistakenelf / fm

A terminal based file manager
MIT License
564 stars 29 forks source link

fm hangs when navigating to folder with vast amount of files #87

Closed mrusme closed 2 years ago

mrusme commented 2 years ago

When I open my downloads folder (which contains half the internet of files of all sorts of types) fm simply hangs and won't let me do anything. Even Ctrl+C hangs.

The folder cointains approx 857 files, many of which are images, pdfs and zips.

mrusme commented 2 years ago

It looks like it's due to the file size calculation. If I just let it stand for a while fm will eventually become responsive again. Is there a way to ....

mrusme commented 2 years ago

Oh snap, changing the dir and going back results in a full re-calculation of the sizes.

Would it be possible to cache the values?

I'm not quite certain why this takes that much time however. A simple ls -la in that directory completes in 0.03s using exa and also displays the file sizes.

mistakenelf commented 2 years ago

I had noticed this as well actually with a node_modules directory. Will look at adding a config to disable the size calculation. It runs in separate go routines but for some reason hangs when there is a lot of directories and files. The size calculation is recursively going through directories and calculating the size of all the files in there which ls does not do. That being said I plan to look into why this happens

mistakenelf commented 2 years ago

@mrusme just released 0.13.4 which adds a config value for calculated_file_sizes which by default will be false. Going to look into why the UI freezes up on large directories with calculated file sizes on

mrusme commented 2 years ago

Just upgraded, works perfectly smooth, thanks! File sizes for files show up instantly and no UI hangs to be noticed.