I have one million text files (contents are about 1kB) and repeatedly get a handle on a random one (FindFirstFile) inside a C++ program in Windows 7. I believe NTFS' b+ tree method quickly does this but, since I know that these files are not changing, I would like this procedure done even faster with RAM (i.e., with no hard drive reads after some pre-loading).
I could pre-load all one million files (ReadFile, or similarly with CreateFileMapping), but I don't know how to get the b+ tree into RAM. Is there a simple solution or API for this where I don't need to build a new tree from scratch? Is there an even faster method?
I also don't want to build a directory tree; I just want to leave all the files in one folder and leverage NTFS' tree method if possible; I'm kind of looking for a "CreateDirectoryMapping" function. (Also, is there any chance that Windows might be automatically caching the b+ tree in RAM after I first use it? I'm guessing no, which is why I want to deliberately cache it for this question.)