Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Speed of Perl Regex Engine

by moritz (Cardinal)
on Nov 28, 2012 at 16:23 UTC ( #1006068=note: print w/replies, xml ) Need Help??

in reply to Speed of Perl Regex Engine

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006068]
NodeReaper silently materializes above an unsuspecting visitor

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2018-03-19 07:39 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (236 votes). Check out past polls.