Re: Use bsearch() instead of a manual binary search in syscache.c
| От | Thomas Munro |
|---|---|
| Тема | Re: Use bsearch() instead of a manual binary search in syscache.c |
| Дата | |
| Msg-id | CA+hUKG+6c2Yqp6OgVjGWzKn9EbaeWs-p9jaEeTBXJ62O0CougA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Use bsearch() instead of a manual binary search in syscache.c (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Use bsearch() instead of a manual binary search in syscache.c
|
| Список | pgsql-hackers |
On Sun, Nov 9, 2025 at 6:01 AM Tom Lane <tgl@sss.pgh.pa.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. [1] https://github.com/scandum/binary_search
В списке pgsql-hackers по дате отправления: