Directory content obtained very slowly when number of its elements grows

Hello everyone!
If a directory contains hundreds of items (or more) then Windows Explorer and Android App take too much time to display contents of such a directory - even minutes some times. I understand that any modern CPU significantly hides this problem but there are very many “office-class” computers with Intel Core CPU of old generations and even modern Pentiums with low frequencies - they are not supposed to be replaced, because there’s no need… And still my mobile Snapdragon 821 can’t make that job quickly too…
Decrypting directory content happens every time despite that had been done very short time ago.
Is it possible to develop some kind of a cash layer to store and give decrypted filenames and directory names to a user very fast?
That could be an option with parameters to avoid probable sync delays in intensive multi-user cases.
Does somebody have the same problem and sustains me?

The actual decryption is not the bottleneck (and yes, some names are already cached). The problem with huge directory listings (at least on Windows) is a huge number of individual I/O requests. For some reason Windows asks for file metadata such as permissions or modification date on a per-file basis rather than during the directory listing.

On Android, I can’t tell you what is the main cause, but I can imagine it to be a similar reason. @SailReal Are we sending requests to the cloud storage service for each file we list? Or is it only one request per directory?

On Android usually we send one request per directory but in case of very long file name (of the files/folders) we’ve to make more requests.

Just did a short test (this is not really representative and depends on very many factors) but on my OnePlus 3T it took 2.5s to display a random folder with 18 files/folders inside and 7s to display a folder with 4200 files/folder using WebDAV and my hosted Nextcloud. But as I said, this is not a representative study, I just wanted to get an impression.

Which cloud storage do you use @Qlavrt? And do you have a lot of really long file names (> 80 chars)?

18 files/folders ~ 2.5s
22:49:13.107 GetCloudListUseCase: started 1c79bddb
22:49:13.126 OkHttp: --> PROPFIND https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND http/1.1 (124-byte body)
22:49:15.207 OkHttp: <-- 207 Multi-Status https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND (2078ms)
22:49:15.425 GetCloudListUseCase: finished 1c79bddb

--------------------------------------------------------

4200 files/folders ~ 7s
22:50:23.284 GetCloudListUseCase: started 1c79bddc
22:50:23.293 OkHttp: --> PROPFIND https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND/03N7TERTAB2QGY2XEZVP5W3LAORGAUDY5VP7VWUENPU====== http/1.1 (124-byte body)
22:50:23.950 OkHttp: <-- 207 Multi-Status https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND/03N7TERTAB2QGY2XEZVP5W3LAORGAUDY5VP7VWUENPU====== (649ms)
22:50:24.016 OkHttp: --> GET https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND/03N7TERTAB2QGY2XEZVP5W3LAORGAUDY5VP7VWUENPU====== http/1.1 (unknown length)
22:50:24.474 OkHttp: <-- 200 OK https://URL/remote.php/webdav/Pictures/d/B2/4UPEUW3Q43KKGBFMWCY523LKAIUNND/03N7TERTAB2QGY2XEZVP5W3LAORGAUDY5VP7VWUENPU====== (453ms)
22:50:24.513 OkHttp: --> PROPFIND https://URL/remote.php/webdav/Pictures/d/42/N5LGYLYOYLRUUHV4RLIOKC276VHJWA http/1.1 (124-byte body)
22:50:25.427 OkHttp: <-- 207 Multi-Status https://URL/remote.php/webdav/Pictures/d/42/N5LGYLYOYLRUUHV4RLIOKC276VHJWA (908ms)
22:50:30.671 GetCloudListUseCase: finished 1c79bddc

@SailReal , We use disk.yandex.ru. I can send you public link to a copy of encrypted files, you can look to directories and files (if there is a way without decrypting). I couldn’t find names longer then 80 chars, but almost all of them consist of cyrillic chars, which double name length (Am I right), and there are many with more then 40 chars. Besides, full paths are pretty long - does it matter?
Accessing to the cloud from android device via wifi.
But still, caching filenames and other attributes could be a relief while navigating directory tree :slight_smile:
Windows App performance is more important because it is used much more time(s).