Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Speed of Perl Regex Engineby moritz (Cardinal) |
on Nov 28, 2012 at 16:23 UTC ( [id://1006068]=note: print w/replies, xml ) | Need Help?? |
The reports for those banks do take noticeably longer to produce than when the system first went online That sounds as if lots of stuff might have been changed in between. Run a profiler over the script(s) and see where the time is actually spent. I don't have much knowledge of or feel for the performance of the Perl Regex engine. Is it linear, like will it take ten times as long to match against a 600-character Regex than against a 60-character one? In general, it doesn't depend much on the length of regex, but on the amount of backtracking and searching that the regex engine has to do. If it's just a big alternation of constant strings, and you use perl 5.10.0 or newer, the trie optimization in the regex engine should handle that case very well (sub-linear even). If your regex grows too big, try increasing ${^RE_TRIE_MAXBUF} -- but only if it's the regex that's actually slow. And as already mentioned, if you can solve your problem through a hash lookup, that would be even better.
In Section
Seekers of Perl Wisdom
|
|