I have a C++ application running on Windows that wakes up every 15 mins to open & read files present in a directory. The directory changes on every run.
- open is performed by *ifstream.open(file_name, std::ios::binary)*
- read is performed by streambuf ios::rdbuf()*
- Total number of files every 15 mins is around 50,000
- The files are opened & read in batches of 20
- The size of each file is around 50 Kbytes
For each run; this operation (open & read) takes around 18-23 mins on a dual-core machine with disk spindle speed of 6000 RPM. I have captured the memory page fault /sec and they are in the range of 8000 – 10000.
Is there a way to reduce the page faults and optimize file open & read operation?
Gowtham