Re: Another regexp performance improvement: skip useless paren-captures
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Joel Jacobson <joel@compiler.org>
Date: 2021-08-05T15:41:38Z
Lists: pgsql-hackers
On 8/5/21 10:39 AM, Robert Haas wrote: > On Thu, Aug 5, 2021 at 9:43 AM Andrew Dunstan <andrew@dunslane.net> wrote: >> On 8/4/21 6:15 PM, Tom Lane wrote: >>> Here's a little finger exercise that improves a case that's bothered me >>> for awhile. In a POSIX regexp, parentheses cause capturing by default; >>> you have to write the very non-obvious "(?:...)" if you don't want the >>> matching substring to be reported by the regexp engine. >> It's not obscure to perl programmers :-) > Well, I consider myself a pretty fair perl programmer, I also consider you one :-) Perhaps I should have said "many perl programmers". > and I know > there's a way to do that, but I never do it, and I would have had to > look up the exact syntax. So +1 from me for anything automatic that > avoids paying the overhead in some cases. Yeah, I'm not arguing against the idea. I also have to look it up, mainly because there is such a huge amount of stuff that can follow "(?", do "perldoc perlre" happens a lot when I'm doing that sort of work. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com
Commits
-
Fix regexp misbehavior with capturing parens inside "{0}".
- 92620e82f6a1 12.9 landed
- 7e75fe390b68 9.6.24 landed
- 3ebd32e70c09 11.14 landed
- 244dd79923a1 14.0 landed
- 071146184a59 13.5 landed
- 062c4c791937 10.19 landed
- 65dc30ced64c 15.0 landed
-
Let regexp_replace() make use of REG_NOSUB when feasible.
- 18bac60ede44 15.0 landed
-
Fix bogus assertion in BootstrapModeMain().
- e12694523e7e 15.0 cited
-
Avoid determining regexp subexpression matches, when possible.
- 0e6aa8747d43 15.0 landed
-
Check the size in COPY_POINTER_FIELD
- c1132aae336c 15.0 cited
-
Make regexp engine's backref-related compilation state more bulletproof.
- cb76fbd7ec87 15.0 cited