Re: Another regexp performance improvement: skip useless paren-captures
| От | Mark Dilger |
|---|---|
| Тема | Re: Another regexp performance improvement: skip useless paren-captures |
| Дата | |
| Msg-id | CD86BE1C-C5F9-4AC5-A932-B26CC5F1FE15@enterprisedb.com обсуждение исходный текст |
| Ответ на | Re: Another regexp performance improvement: skip useless paren-captures (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Another regexp performance improvement: skip useless paren-captures
|
| Список | pgsql-hackers |
> On Aug 9, 2021, at 6:11 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Hm. I'm not sure that this example proves anything about Perl's handling
> of the situation, since you didn't use a backref.
Well, this doesn't die either:
if ('foo' =~ m/((??{ die; })(.)(??{ die $1; })){0}((??{ die "got here"; })|\2)/)
{
print "matched\n";
}
The point is that the regex engine never walks the part of the pattern that {0} qualifies. I thought it was more clear
inthe prior example, because that example proves that the engine does get as far as capturing. This example also does
that,and with a backref, because it dies with "got here".
—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: