Re: Some regular-expression performance hacking

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Some regular-expression performance hacking
Date: 2021-02-18 20:54:38
Message-ID: 87316a6a-2c84-4888-b58f-a53812aca369@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 18, 2021, at 21:44, Tom Lane wrote:
>Hmm ... I might be misunderstanding, but I think our engine already
>does a version of this. See the discussion of "colors" in
>src/backend/regex/README.

Thanks, I will read it with great interest.

>Maybe. In practice the actual scanning tends to be tracking more than one
>possible NFA state in parallel, so I'm not sure how often we could expect
>to be able to use this idea. That is, even if we know that state X can
>only succeed by following an arc to Y and then another to Z, we might
>also be interested in what happens if the NFA is in state Q at this point;
>and it seems unlikely that Q would have exactly the same two following
>arc colors.

Right. Actually I don't have a clear idea on how it could be implemented in an NFA engine.

>I do have some ideas about possible future optimizations, and one reason
>I'm grateful for this large set of real regexes is that it can provide a
>concrete basis for deciding that particular optimizations are or are not
>worth pursuing. So thanks again for collecting it!

My pleasure. Thanks for using it!

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-02-18 21:03:56 Re: Improvements and additions to COPY progress reporting
Previous Message Tom Lane 2021-02-18 20:44:47 Re: Some regular-expression performance hacking