perlquestion
perrin
I'm trying to speed up a script which finds all lines in a large (20MB) file that contain a certain string. Because partial matches are allowed, I can't use an [CPAN://Search::InvertedIndex|inverted word list] approach for this. I've sped things up by using <CODE>index()</CODE> instead of a regex, but it still takes too long.<p>
So far, the only idea I've had is to use <CODE>read()</CODE> to pull in 4K chunks, qualify them with <CODE>index()</CODE> and only parse them line-by-line if the chunk qualifies.<p>
Does anyone have any other ideas? FYI, this script will be running under mod_perl.