I realize that a "step count" is not necessarily a true indication of performance of a regular expression, but it would be a valuable tool, and could provide valid performance indication when comparing two different regular expression approaches on a given target string. I hope you'll keep it in mind, when you get around to extending/maintaining Regex Coach some time in the future. rgds, Morten On 5/2/05, Edi Weitz edi@agharta.de wrote:
On Mon, 2 May 2005 16:05:46 +0200, Morten Hattesen < morten.hattesen@gmail.com> wrote:
I really appreciate what Regex Coach has done for honing my Regular Expressions skills, and assisting debugging of complex expressions.
I frequently wish to optimize regular expressions (mainly by reducing possible backtracking http://www.regular-expressions.info/atomic.html), but lack a way to test the relative performance between different regular expressions.
To measure performance of a given regexp, I would really like the possibility of having Regex Coach count the total number of steps used by the underlying regexp engine for a given regexp search, or some other meaningful performance indicator.
This could possibly be displayed when pressing the ">>" (show next match) button (regardless of whether a match was found or not). This way, you can quickly try out different matching approaches, and get an indication of the relative performance.
Hi Morten!
I see a couple of problems here:
- As you mentioned yourself already the number of "steps" used is not
necessarily a good measure for the efficiency of a regular expression.
- The efficiency of a regular expression might depend heavily on the
target strings it's used with - a regex that's pretty good for a certain subset of all possible strings might be particularly bad for another subset.
- Plus, the efficiency of a regular expression will also depend on
the underlying implementation - even if, say, Perl and PHP use the same regex syntax they use different engines which employ different optimization strategies.
Having said that, even if I had a good idea how to give performance hints I wouldn't be able to add this to Regex Coach in the near future because I'm very busy with other projects.
Cheers, Edi.