Replace binary search in fmgr_isbuiltin with a lookup array.
Andres Freund <andres@anarazel.de>
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.a5sk7z4xde5uy3ei@alap3.anarazel.de
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/fmgr/fmgr.c | modified | +12 −17 |
| src/backend/utils/Gen_fmgrtab.pl | modified | +66 −13 |
| src/backend/utils/Makefile | modified | +1 −1 |
| src/include/utils/fmgrtab.h | modified | +9 −2 |
Discussion
- Binary search in fmgr_isbuiltin() is a bottleneck. 33 messages · 2017-09-14 → 2017-10-05