postgresql/src/common
Tom Lane c64d0cd5ce Use perfect hashing, instead of binary search, for keyword lookup.
We've been speculating for a long time that hash-based keyword lookup
ought to be faster than binary search, but up to now we hadn't found
a suitable tool for generating the hash function.  Joerg Sonnenberger
provided the inspiration, and sample code, to show us that rolling our
own generator wasn't a ridiculous idea.  Hence, do that.

The method used here requires a lookup table of approximately 4 bytes
per keyword, but that's less than what we saved in the predecessor commit
afb0d0712, so it's not a big problem.  The time savings is indeed
significant: preliminary testing suggests that the total time for raw
parsing (flex + bison phases) drops by ~20%.

Patch by me, but it owes its existence to Joerg Sonnenberger;
thanks also to John Naylor for review.

Discussion: https://postgr.es/m/20190103163340.GA15803@britannica.bec.de
2019-01-09 19:47:46 -05:00
..
unicode Update copyright for 2019 2019-01-02 12:44:25 -05:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
base64.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
config_info.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
controldata_utils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
exec.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
fe_memutils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_perm.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_utils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
ip.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
keywords.c Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
kwlookup.c Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
link-canary.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
Makefile Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
md5.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_lzcompress.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgfnames.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
psprintf.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
relpath.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
restricted_token.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
rmtree.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
saslprep.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
scram-common.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2_openssl.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
string.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
unicode_norm.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
username.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
wait_error.c Update copyright for 2019 2019-01-02 12:44:25 -05:00