postgresql/src/backend/utils
Tom Lane 4a14f13a0a Improve hash_create's API for selecting simple-binary-key hash functions.
Previously, if you wanted anything besides C-string hash keys, you had to
specify a custom hashing function to hash_create().  Nearly all such
callers were specifying tag_hash or oid_hash; which is tedious, and rather
error-prone, since a caller could easily miss the opportunity to optimize
by using hash_uint32 when appropriate.  Replace this with a design whereby
callers using simple binary-data keys just specify HASH_BLOBS and don't
need to mess with specific support functions.  hash_create() itself will
take care of optimizing when the key size is four bytes.

This nets out saving a few hundred bytes of code space, and offers
a measurable performance improvement in tidbitmap.c (which was not
exploiting the opportunity to use hash_uint32 for its 4-byte keys).
There might be some wins elsewhere too, I didn't analyze closely.

In future we could look into offering a similar optimized hashing function
for 8-byte keys.  Under this design that could be done in a centralized
and machine-independent fashion, whereas getting it right for keys of
platform-dependent sizes would've been notationally painful before.

For the moment, the old way still works fine, so as not to break source
code compatibility for loadable modules.  Eventually we might want to
remove tag_hash and friends from the exported API altogether, since there's
no real need for them to be explicitly referenced from outside dynahash.c.

Teodor Sigaev and Tom Lane
2014-12-18 13:36:36 -05:00
..
adt Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
cache Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
error Support frontend-backend protocol communication using a shm_mq. 2014-10-31 12:02:40 -04:00
fmgr Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
hash Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
init Move the backup-block logic from XLogInsert to a new file, xloginsert.c. 2014-11-06 13:55:36 +02:00
mb Add file version information to most installed Windows binaries. 2014-07-14 14:07:52 -04:00
misc Print wal_log_hints in the rm_desc routing of a parameter-change record. 2014-12-05 12:00:48 +02:00
mmgr Fix and enhance the assertion of no palloc's in a critical section. 2014-06-30 10:26:00 +03:00
resowner
sort Remove incorrect comment. 2014-11-11 18:41:29 -05:00
time Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
.gitignore
errcodes.txt
Gen_dummy_probes.sed
Gen_fmgrtab.pl
generate-errcodes.pl
Makefile
probes.d