Re: [pcre-dev] Subject length lower bound calculation

Αρχική Σελίδα
Delete this message
Συντάκτης: ph10
Ημερομηνία:  
Προς: ND
Υ/ο: Pcre-dev
Αντικείμενο: Re: [pcre-dev] Subject length lower bound calculation
On Wed, 5 Jun 2019, ND via Pcre-dev wrote:

> May be there is a some space for optimization there.
>
> PCRE analyze subpattern in lookaround and say:
> First code unit = 'a'
> Last code unit = 'c'
>
> So it already knows that "Subject length lower bound" is greater than 0.
> Isn't it?


Yes, that's true; it could easily set the lower bound to 2 from that
information. I will taks a look at that. Thanks for the idea, though it
can only be of small benefit as it will cut out only 2 match attempts.

The subject length optimization does not do very deep analysis. It is
cheap code that makes a useful difference in many cases without too much
work. To handle lookarounds fully would be more complicated and would
benefit only a few cases where a positive lookahead reads more than what
follows.

Philip

--
Philip Hazel