in reply to Speeding up a large regex match pattern
As a general proposition, avoiding using unnecessary captures is a Good Thing.
Also as a general proposition, optimisation should be avoided until it becomes obvious that it is unavoidable.
use re 'debug' can tell you a lot about what's going on -- getting a trace of what happens on some real data can be quite instructive. YAPE::Regex::Explain is reputed to be useful, but it does look a little old -- other monks may be able to advise.
One thing that can really slow down regex is back-tracking. The more specific the matching elements, the less opportunity you give for backtracking, the better. Note that a floating start to a regex is an excellent way of triggering a lot of backtracking !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Speeding up a large regex match pattern
by wossname (Novice) on Feb 04, 2009 at 21:35 UTC |