Well, "extract info" (in your pseudocode) is pretty vague. There are a lot of ways to grab fixed-width data from a file. The ones that come to mind ...
- regexes (slowest)
- split (usually ok)
- unpack (usually fastest)
I'd recommend switching the parsing to
unpack, you will probably see a big speedup (especially if you're currently grabbing the data with regexes). Use the "A<num>" pack template to get a <num>-character field from the data.
Actually, you should benchmark split vs. unpack against your data but I'm almost positive unpack will be faster.
blokhead