[pcre-dev] Strangely long matching times. Could anyone help …

Pàgina inicial
Delete this message
Autor: Ralf Junker
Data:  
A: pcre-dev@exim.org
Assumpte: [pcre-dev] Strangely long matching times. Could anyone help to explain?
Below is a test file for pcre2test which shows matching times which I
cannot explain. I run it on Windows like this:

pcre2test -tm 1 tests.txt

If I understand this correctly, at least the atomic grouping pattern
should run fast: https://www.regular-expressions.info/catastrophic.html

Interestingly, with JIT all patterns run instantly in 0 ms:

pcre2test -jit -tm 1 tests.txt

I am using PCRE2 SVN 1284.

Could anyone jump in with an explanation?

Many thanks,

Ralf

----------

# Match is instantaneous (0 milliseconds).

/aa.*?bb/
\[aa                                 bb ]{200}


# Failure with extra letter "x" is also extremely fast (0 milliseconds).

/aa.*?bbx/
\[aa                                 bb ]{200}


# Failure with extra letter "y" is just as fast (0 milliseconds).

/aa.*?bby/
\[aa                                 bb ]{200}


# Failure with extra letter "a" is very slow (> 6000 ms).

/aa.*?bba/
\[aa                                 bb ]{200}


# Failure with extra letter "b" is also very slow (> 6000 ms).

/aa.*?bbb/
\[aa                                 bb ]{200}


# Atomic grouping does not help (each > 6000 ms).

/aa(?>.*?bba)/
\[aa                                 bb ]{200}


/aa(?>.*?bbb)/
\[aa                                 bb ]{200}


# Is this expected behavior? Suggestions? Thank you!