I have a 2 GB file (iputfile.txt
) in which every line in the file is a word, just like:
apple
red
beautiful
smell
spark
input
I would also try using mmap instead of standard file read/write. This should let your OS handle the reading and writing while your application is only concerned with the data.
There's no situation where C++ can't be faster than Java, but sometimes it takes a lot of work from very talented people. But I don't think this one should be too hard to beat as it is a straightforward task.
mmap for Windows is described in File Mapping (MSDN).