Replace binary search in fmgr_isbuiltin with a lookup array.
authorAndres Freund
Wed, 4 Oct 2017 07:22:38 +0000 (00:22 -0700)
committerAndres Freund
Wed, 4 Oct 2017 07:22:38 +0000 (00:22 -0700)
commit212e6f34d55c910505f87438d878698223d9a617
treed4901af435b9ffe5c41aad37608767dc5c7dc422
parent18f791ab2b6a01a632653d394e046f3daf193ff6
Replace binary search in fmgr_isbuiltin with a lookup array.

Turns out we have enough functions that the binary search is quite
noticeable in profiles.

Thus have Gen_fmgrtab.pl build a new mapping from a builtin function's
oid to an index in the existing fmgr_builtins array. That keeps the
additional memory usage at a reasonable amount.

Author: Andres Freund, with input from Tom Lane
Discussion: https://postgr.es/m/20170914065128[email protected]
src/backend/utils/Gen_fmgrtab.pl
src/backend/utils/Makefile
src/backend/utils/fmgr/fmgr.c
src/include/utils/fmgrtab.h