Possible Duplicate:
What is the Fastest Method for High Performance Sequential File I/O in C++?
I have looked around a little bit and I am still not sure of the answer to this question.
When reading from a text file with an arbitrary word on every line, what would be the absolute fastest way of reading the words from that file? The scope of the project requires the fastest possible file read.
Using Visual Studio on Windows 7. No cross platform consideration.
Edit:
Keep in mind, this file read is a one time thing, it will not be read from again and it will not be written to. The program starts, reads from the file, pushes it into a data structure and the loadFile() function is never called again.
As I understand your question your objective is to read a file of words and insert each word into some data structure. You want this read+insertion to be as fast as possible. (I won’t debate the rationale for or the wisdom of this, I’ll just accept is as a requirement. 🙂 )
If my understanding is correct, then perhaps an alternative approach would be to write a utility program that will read the file of words, insert them into the data structure, and then serialize that data structure to a file (say BLOB.dat, for example). Then your main program will deserialize BLOB.dat into the data structure that you require. Essentially you pre-process the words file into some intermediate binary format that can be loaded into your data structure most efficiently. Or would this be cheating in your scenario??