| From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Antonin Houska <ah(at)cybertec(dot)at>, cca5507(at)qq(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Use bsearch() instead of a manual binary search in syscache.c |
| Date: | 2025-11-09 01:55:21 |
| Message-ID: | CA+hUKG+6c2Yqp6OgVjGWzKn9EbaeWs-p9jaEeTBXJ62O0CougA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Nov 9, 2025 at 6:01 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I'm quite certain that years ago we determined that bsearch()
> was slower than a manually written-out loop, probably because of
> exactly the point that the comparisons would be inline. Don't
> know whether modern compilers have changed that conclusion.
It looks like glibc's version is inlined, but others I checked aren't.
> There are places where we wouldn't care about such microscopic
> performance details, but I think syscache.c is not one of them.
So we'd probably need our own inline function to keep the playing
field level. Some tweaked algorithms[1] are also said to speed up
small integer tables, Unicode tables etc.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Xuneng Zhou | 2025-11-09 03:11:58 | Re: Add tab completion support for WAIT FOR command |
| Previous Message | Thomas Munro | 2025-11-09 00:29:36 | Re: MSVC: Improve warning options set |