From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@lists.postgresql.org, Joel Jacobson <joel@compiler.org>
Subject: Re: Another regexp performance improvement: skip useless paren-captures
Date: Thu, 05 Aug 2021 10:36:21 -0400
Message-ID: <2390507.1628174181@sss.pgh.pa.us> (raw)
In-Reply-To: <31908a04-f73b-8c5b-ed99-919fd4cd4b54@dunslane.net>
References: <2219936.1628115334@sss.pgh.pa.us>
<31908a04-f73b-8c5b-ed99-919fd4cd4b54@dunslane.net>
Andrew Dunstan <andrew@dunslane.net> writes:
> I'm a bit worried about how you'll keep track of back-ref numbering
> since back-refs only count capturing groups, and you're silently turning
> a capturing group into a non-capturing group.
They're already numbered at this point, and we aren't changing the numbers
of the capturing groups that remain live. There will be unused entries in
the regmatch_t array at runtime (corresponding to the zapped groups), but
that doesn't cost anything worth mentioning.
Now that you mention it, I am not sure whether there are any regression
test cases that specifically cover still being able to match \2 when
the first capture group went away. Probably should add more cases...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrew@dunslane.net, joel@compiler.org
Subject: Re: Another regexp performance improvement: skip useless paren-captures
In-Reply-To: <2390507.1628174181@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox