Folder stuck at scanning issue relates to case insensitivity for a very long time.
Directory listing on my Android is slow - I’ve always seen that using adb, as busybox ls seems to always fetch the attributes:
lisa:/storage/emulated/0/DCIM/Camera $ strace -efile ls
openat(AT_FDCWD, “.”, O_RDONLY) = 3
newfstatat(4, “Raw”, {st_mode=S_IFDIR|S_ISGID|0770, st_size=3452, …}, AT_SYMLINK_NOFOLLOW) = 0
newfstatat(4, “thumbnails”, {st_mode=S_IFDIR|S_ISGID|0770, st_size=3452, …}, AT_SYMLINK_NOFOLLOW) = 0
– these newfstatat() calls are not necessary for short (filename-only) listing (not to mention using file descriptors…), single getdents64() is enough. On linux there’s the new statx() (well, compared to stat(), 8 years old now, but kernel 4.11 is still new for some embedded hardware) call for better performance.
At first glance, reading file attributes shouldn’t be required for case-checking, only pure directory read. And this should be fast even without application-level cache…
So I wonder - isn’t that ReadDir() mentioned by @calmh invoking stating all the files? Anyone familiar with codebase can share some insights?