in reply to Script far too slow with large files - wisdom needed!
The simplest way to speed up your second loop would be to skip over all the non-title lines:
my( $ti, $rt ); { { local $/ = "TITLE="; <MGF>; } ( $ti ) = <MGF> =~ m[^(\S+)]; { local $/ = "RTINSECONDS="; <MGF> } ( $rt ) = <MGF> =~ m[^(\S+)]; if( exists $IDS{ $ti } ) { $IDrtPairs{ $ti } = $rt; } redo unless eof( MGF ); }
Warning untested code that probably needs a couple of tweaks, but should explain the idea.
|
|---|