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

From cca5507
Subject Re: Use bsearch() instead of a manual binary search in syscache.c
Date
Msg-id tencent_E18534B54929113201787B07D37676A14E08@qq.com
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
Hi,

Thanks for the explanation which helps me a lot!

The bsearch() got inlined according to compiler explorer:

https://godbolt.org/z/1x69zGMcn

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.
How about add a pg_bsearch() and #define bsearch(a,b,c,d,e) pg_bsearch(a,b,c,d,e) to use it?

--
Regards,
ChangAo Chen

pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: pg_dump not dumping default_text_search_config WAI?
Next
From: Roman Eskin
Date:
Subject: Re: Avoid orphaned objects dependencies, take 3