Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Speed of Perl Regex Engine

by moritz (Cardinal)
on Nov 28, 2012 at 16:23 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1006068]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found