We don't bite newbies here... much | |
PerlMonks |
Re: Script far too slow with large files - wisdom needed!by flexvault (Monsignor) |
on Jan 22, 2016 at 08:52 UTC ( [id://1153357]=note: print w/replies, xml ) | Need Help?? |
Hello biologistatsea, You've gotten some good pointers, but no-one has mentioned using 'index' instead of a regex. 'index' and 'substr' are extremely fast if used properly. (Untested example).
Remember 'index' returns '-1' if the string is not found, so you have to test for a positive number. ( Can't do 'if ( $si )' since '-1' is 'not 0' and is TRUE. I've seen 10 to 50 times improvement on many-GByte files. YMMV. Regards...Ed "Well done is better than well said." - Benjamin Franklin
In Section
Seekers of Perl Wisdom
|
|