develooper Front page | perl.perl5.porters | Postings from February 2009

Re: regexp iteration limits

Thread Previous | Thread Next
From:
demerphq
Date:
February 11, 2009 16:10
Subject:
Re: regexp iteration limits
Message ID:
9b18b3110902111610v725cdd18v2f78cb53653b2382@mail.gmail.com
2009/2/10 Zefram <zefram@fysh.org>:
> Secondarily, perl ought to pay attention to (?>...), to avoid generating
> backtracking records that it can never use.

Im doubtful this will happen.

You see, (?>...) turns into two regops, that bracket a set of other regops.

These regops push records onto the stack. If we were to check to see
if we were "inside" of the regops that bracket the expression we would
pay a price for every regop, regardless if they used the (?>...)
construct, which isnt really used that often. So instead we just let
them accumulate information in the stack, and then throw it all away
when we hit the closing regop. Its not perfect but it lets the people
that use the construct pay the price. I guess we could bifurcate all
the regops, but that gets messy.

What id rather see happen is that perl does on the fly DFA
construction when it makes sense to do so. The effect would be the
same, but we would have a generic solution to a whole class of
problems and not a special case for every regop based on a special
regex construct.

cheers,
Yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About