The first thing to do is drop all the /g options on your regexes. You only need to know if it exists, not if it exists more than once, unless you are going to bother to do something with the latter information which you aren't currently. That could save some processing.
You could save some more time by not performing the checks for "Legal" or "Tabloid" if you already found "Letter". The same for the other catagories, That ought to cut the processing time by around half (guess!!)
If you order the various types by the most frequent usage, it might save a bit more.
Finally, if you have 60+ MB of ram to spare, you might save some time by slurping the file into a scalar and then running your regexes against that. If you do this, make sure that you don't use the /g option or apply more regexes than you need to. (ie. No Duplex of you already found Simplex etc.)
In reply to Re: Fast file parsing
by BrowserUk
in thread Fast file parsing
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |