I am working on a big (~500Mb) RAW txt file. There are about 20,000,000 lines in the file. Each line includes one double and one int. For example:
45782.1234852 10
Below is my simple code:
QTextStream rdStream(&qFile_Input);
while (!rdStream.atEnd())
{
//QStringList qList_data=rdStream.readLine().split(" ",QString::SkipEmptyParts);
rdStream.readLine();
}
It takes about 30 seconds just to read line QTextStream::readLine();
If I add .split(" ",QString::SkipEmptyParts) into a Qstringlist, then the total time required jumps to 5 minutes. My question is three fold:
- Where does the time gap comes from?
- Is there a way to get a shorter processing time?
- If my file is larger than the RAM of PC, will I encounter an error? If so, what can I do?
Thanks in advance!