Re: Binary search in fmgr_isbuiltin() is a bottleneck.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Robert Haas <robertmhaas@gmail.com>,
Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-10-05T18:54:02Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes: > On 2017-10-05 17:08:39 +0300, Heikki Linnakangas wrote: >> BTW, there's some alignment padding in FmgrBuiltin, when MAXIMUM_ALIGNOF==8. >> You could easily shrink the struct from 32 to 24 bytes by moving funcName to >> the end of the struct: > Yea, that's probably worthwhile, although I suspect it's not a huge save > overall. Do you just want to commit that? +1 >> If we care about cache efficiency here, we could move funcName out of the >> fmgr_builtins array, to a separate array of the same size. > When'd that be beneficial? fmgr_builtins is pretty much only used for > internal-language CREATE FUNCTIONs? In other cases oid bounds + mapping > array should filter out the access before fmgr_builtins is accessed. I'm -1 on this, it would complicate using the data structure to look up the name of a built-in function from its OID. (Don't know that anyone actually does that, but I see no reason to break their code if they do.) regards, tom lane
Commits
-
Replace binary search in fmgr_isbuiltin with a lookup array.
- 212e6f34d55c 11.0 landed
-
Add inline murmurhash32(uint32) function.
- 791961f59b79 11.0 cited