Autor: Philip Hazel Data: Para: NN CC: pcre-dev Asunto: Re: [pcre-dev] Optimizations when execution order is important
On Wed, 17 Dec 2008, NN wrote:
> So, the feature of disabling "disordering" optimizations is already
> present in PCRE.
No. The feature of disabling *one specific* optimization is already
present. I have not looked through the code to see what other
optimizations might affect callouts. I have said that I will do so when
I next work on PCRE - not for a couple months, however. I am not sure
how easy it will be to be sure of finding all the optimizations, and
checking if they would affect callouts. Some, I know, are not a problem:
for example, if you have /a{4}.../ and you pass it a string of 3
characters it will fail without looking at them, because it knows it
needs 4 characters. However, it will also look forwards for "a" before
it starts matching. Without looking into the code, I don't know how it
deals with the case of a callout before the "a" when there is no match.
There is a big performance hit in not doing the pre-scan for "a".
Disabling this optimization whenever there is a callout in the pattern
is not good. Probably this could be arranged only if the callout comes
before the "a" ... but I'll have to study the code to be sure.