Re: Use bsearch() instead of a manual binary search in syscache.c

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Antonin Houska <ah@cybertec.at>
Cc: cca5507@qq.com, pgsql-hackers@lists.postgresql.org
Date: 2025-11-08T13:24:34Z
Lists: pgsql-hackers
On Sun, Nov 9, 2025 at 1:12 AM Antonin Houska <ah@cybertec.at> wrote:
> cca5507 <cca5507@qq.com> wrote:
> > I make a patch for the $subject, which make the code simpler, thoughts?
>
> I proposed something like that earlier [1] but did not get too far. The short
> discussion might be useful for you though.

One factor is that libc bsearch() implementations might not all be
header-only and inlineable.  I vaguely recall that being discussed in
some round of hacking on qsort() and qunique().