shinyFiles icon indicating copy to clipboard operation
shinyFiles copied to clipboard

shinyFiles re-indexes folder contents slowing down performance.

Open PhilipFaure opened this issue 4 years ago • 8 comments

Hi,

We are using your shinyFiles package extensively within an app we are developing. We really like shinyFiles, but we have one issue for which we can not find a work around. Often, users will be working with large hard drives (e.g. 4 Tb drives) and some folders on it may easily contain well over 200,000 images. With such folders, if an user clicks on or tries to open one of these folders using shinyFiles it dramatically slows down. The app we are developing is run using a containerised instance.

My question is whether there is a way to stop shinyFiles from indexing all the files in the content viewer panel, or some other way to speed it up? Perhaps can the viewer be turned off somehow to speed up performance, would that work?

I’ve looked extensively on stackoverflow and other sites for anyone else reporting a similar issue, but with no success.

Thank you in advance for your time,

Best Wishes, Philip

PhilipFaure avatar May 18 '20 09:05 PhilipFaure

I assume you are talking explicitly about the shinDirChoose? There is currently no way to turn off the preview. I agree that it might make sense to try and limit the size of the preview.

vnijs avatar May 19 '20 18:05 vnijs

@vnijs @PhilipFaure – we are having the same issue for shinyDirChoose. Is there any plan to allow users to limit these previews, @vnijs? That may really help! Thanks

pantheracorp avatar May 27 '20 04:05 pantheracorp

I could add a max_files argument to shinyDirChoose. If you set that to, e.g., 1000 you wouldn't only see the first 1000 entries from fs::dir_ls. Would that work for you?

vnijs avatar May 27 '20 05:05 vnijs

Hi @vnijs, that would work, assuming it'll speed up the process? Thank you!

pantheracorp avatar May 27 '20 05:05 pantheracorp

Try the below and let me know if you see any issues:

remotes::install_github("thomasp85/shinyFiles@max_files")

vnijs avatar May 27 '20 05:05 vnijs

The recent update unfortunately increases the computation time, it's taking even longer (~ 50% longer) to drill down into directories when max_files = 10, compared to the default. Just for clarity, when using shinyDirChoose, is the function indexing or caching the entire folder contents? Just trying to get an idea of why there is such a delay. Many thanks

pantheracorp avatar May 27 '20 10:05 pantheracorp

I see no reason why the changes in the commit linked below could increase computation time. I'm afraid you will have to dig into the fileGetter function to explore what might address you specific situation

https://github.com/thomasp85/shinyFiles/commit/680c1c2ec779e0fa892537ea7d06dfe5d4fe2844

vnijs avatar May 29 '20 02:05 vnijs

Hi, just weighing in here, indeed for e.g. NFS mounted home directories things are painfully slow. I'll happily trade speed for eye-candy. Yours, Steffen

sneumann avatar Nov 08 '23 20:11 sneumann