Well, I just booted the computer ;) But you are right, dropping the cache is probably a better way.
I have a folder with 5500 subfolders. Doing "ls -U" in that folder (after dropping the page cache like above) takes 50 seconds (!) And the dir entries appear all at once, i.e. not in a streaming way.
Its parent folder only contains 6 subfolders. Doing a cache drop followed by "ls -U" gives immediate results.
How to investigate this further? (Using an Ubuntu 18.04 system)
It's probably that ls in the other shell is the builtin instead of the binary, when strace runs ls -U it does run the binary and not the shell builtin. tcsh must also delegate to the binary instead of a builtin, or their builtin is faster.
Yeah, I haven't figured it out yet, but when I do /bin/ls, then indeed the problem does not show. Probably a case of Bash trying to be smarter than it needs to be.
I have a folder with 5500 subfolders. Doing "ls -U" in that folder (after dropping the page cache like above) takes 50 seconds (!) And the dir entries appear all at once, i.e. not in a streaming way.
Its parent folder only contains 6 subfolders. Doing a cache drop followed by "ls -U" gives immediate results.
How to investigate this further? (Using an Ubuntu 18.04 system)