Optimize line reading

Cache the result of `File.readlines` when building records. This gives a non-trivial speed-up, especially when the filesystem is not local (e.g. over NFS).