Re: Use bsearch() instead of a manual binary search in syscache.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use bsearch() instead of a manual binary search in syscache.c
Date
Msg-id 1469379.1762621286@sss.pgh.pa.us
Whole thread Raw
In response to Re: Use bsearch() instead of a manual binary search in syscache.c  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:
> 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().

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.

There are places where we wouldn't care about such microscopic
performance details, but I think syscache.c is not one of them.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: MSVC: Improve warning options set
Next
From: Tom Lane
Date:
Subject: Re: pg_dump not dumping default_text_search_config WAI?