This is an example of using a binary index file to speed up random access of lines in a file. The file is indexed one time, where the position of the start of each line is stored in an index file. Subsequent requests for a get the position from the index file and seek directly to it.
Included is the usual naive brute force search for lines to compare performance.