An efficient method for parsing or for that matter processing of files
is to read as much of the file into memory before you start parsing.
File I/O has been, since the dawn of computers, one of the slower parts
of a computer system. For example, parsing your data may take 1
microsecond. Reading the data from a hard drive may take 1 millisecond ==
I've made programs faster by allocating a large array for the data then
reading the data into the array. Next I process the data in the array and
repeat until the entire file is processed.
Another technique is called memory mapping, where the OS handles reading
the file into memory as needed.
Please edit your post to show the code where the bottleneck is.