in reply to Regex, capturing variables vs. speed
Here’s a quick tip: if you do a simple
perl -Mre=debug -le'"some test data here" =~ /your regex here/'
on the command line, you will see a) how the regex engine compiles your pattern, including which optimisations it discovered to be applicable while compiling, and b) which steps it performs during actual matching, including which optimisations actually made a difference. (F.ex., seeing “Match rejected by optimizer” for input you want to reject is ideal, because it means the match failure was detected even before the engine was powered up.)
This is an invaluable aid in understanding the performance characteristics of different patterns, as you can see just what the engine is really doing.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex, capturing variables vs. speed
by monarch (Priest) on Nov 02, 2005 at 03:49 UTC | |
by Aristotle (Chancellor) on Nov 02, 2005 at 04:39 UTC |