Re: Some regular-expression performance hacking

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Joel Jacobson" <joel@compiler.org>
Cc: "Chapman Flack" <chap@anastigmatix.net>, pgsql-hackers@lists.postgresql.org
Date: 2021-02-26T18:55:10Z
Lists: pgsql-hackers
"Joel Jacobson" <joel@compiler.org> writes:
> On Fri, Feb 26, 2021, at 01:16, Tom Lane wrote:
>> 0007-smarter-regex-allocation-2.patch

> I've successfully tested this patch.

Cool, thanks for testing!

> That's a 29% speed-up compared to HEAD! Truly amazing.

Hmm, I'm still only seeing about 10% or a little better.
I wonder why the difference in your numbers.  Either way,
though, I'll take it, since the main point here is to cut
memory consumption and not so much cycles.

			regards, tom lane



Commits

  1. Suppress unnecessary regex subre nodes in a couple more cases.

  2. Improve memory management in regex compiler.

  3. Extend a test case a little

  4. Allow complemented character class escapes within regex brackets.

  5. Suppress compiler warning in new regex match-all detection code.

  6. Avoid generating extra subre tree nodes for capturing parentheses.

  7. Convert regex engine's subre tree from binary to N-ary style.

  8. Fix regex engine to suppress useless concatenation sub-REs.

  9. Recognize "match-all" NFAs within the regex engine.

  10. Invent "rainbow" arcs within the regex engine.

  11. Make some minor improvements in the regex code.

  12. Display the time when the process started waiting for the lock, in pg_locks, take 2

  13. README/C-comment: document GiST's NSN value

  14. doc: Mention NO DEPENDS ON EXTENSION in its supported ALTER commands