I have a directory with 500,000 files. I would like to access them as soon as possible. The algorithm requires that I open and close them many times (cannot simultaneously open 500,000 files).
How can I do this efficiently? Initially, I thought I could cache inodes and open files this way, but * nix does not provide a way to open inodes (security or some).
Another option is to simply not worry about it and hope that FS does a good job of the file in the directory. If this is the best option, then FS will work best. Are some file name patterns faster than others? e.g. 01234.txt vs foo.txt
By the way, all this is on Linux.
source
share