Re: Some regular-expression performance hacking

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Some regular-expression performance hacking
Date: 2021-02-23 17:52:28
Message-ID: 3875615.1614102748@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Hmph. There's an "assert(depth >= 0)" immediately in front of that,
> so I'm not looking too kindly on the compiler thinking it's smarter
> than I am. Do you have a suggestion on how to shut it up?

On reflection, maybe the thing to do is convert the assert into
an always-on check, "if (depth < 0) return false". The assertion
is essentially saying that there's no arc leading directly from
the pre state to the post state. Which there had better not be,
or a lot of other stuff is going to go wrong; but I suppose there's
no way to explain that to gcc. It is annoying to have to expend
an always-on check for a can't-happen case, though.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-02-23 18:05:35 Re: Some regular-expression performance hacking
Previous Message Tom Lane 2021-02-23 17:39:09 Re: Some regular-expression performance hacking