Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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]
[LanX]: choroba: subversive (as usual ;)
[james28909]: i dunno, if i didnt have so little experience in linux i would swap. but it would be to much of a learning curve for me right now.
[choroba]: Low-end is defined as the Perl that generates millions of income
[choroba]: sorry, that's high-end, of coursse
[choroba]: low end, in my talk, will be code that "we don't touch because it works" and noone knows why
[choroba]: I want to present the most bizzare bugs and misfeatures I met when working for a large financial institution
[choroba]: I already gave a similar talk to my friends in a pub and at an internal conference at work and people liked it, so maybe...
[choroba]: LanX: That's the heritage, I can't do anything else
[RonW]: Sounds like some system my employer has "It does exactly what we need it to do and can't afford to risk anything we can't prove is 100% compatible"
[marto]: choroba sounds interesting

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2017-05-22 21:35 GMT
Find Nodes?
    Voting Booth?