aboutsummaryrefslogtreecommitdiff
path: root/src/tools/msvc/Solution.pm
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-01-09 19:47:38 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-01-09 19:47:46 -0500
commitc64d0cd5ce24a344798534f1bc5827a9199b7a6e (patch)
tree3968456d54c3f18d07976e5a139ca60589a8fbf0 /src/tools/msvc/Solution.pm
parent5d59a6c5eaff4a58322683e450e76a11d943d322 (diff)
downloadpostgresql-c64d0cd5ce24a344798534f1bc5827a9199b7a6e.tar.gz
postgresql-c64d0cd5ce24a344798534f1bc5827a9199b7a6e.zip
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
Diffstat (limited to 'src/tools/msvc/Solution.pm')
-rw-r--r--src/tools/msvc/Solution.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 937bf184e27..e4bb9d2394d 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -414,7 +414,7 @@ sub GenerateFiles
'src/include/parser/kwlist.h'))
{
print "Generating kwlist_d.h...\n";
- system('perl src/tools/gen_keywordlist.pl --extern -o src/common src/include/parser/kwlist.h');
+ system('perl -I src/tools src/tools/gen_keywordlist.pl --extern -o src/common src/include/parser/kwlist.h');
}
if (IsNewer(
@@ -426,8 +426,8 @@ sub GenerateFiles
{
print "Generating pl_reserved_kwlist_d.h and pl_unreserved_kwlist_d.h...\n";
chdir('src/pl/plpgsql/src');
- system('perl ../../../tools/gen_keywordlist.pl --varname ReservedPLKeywords pl_reserved_kwlist.h');
- system('perl ../../../tools/gen_keywordlist.pl --varname UnreservedPLKeywords pl_unreserved_kwlist.h');
+ system('perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname ReservedPLKeywords pl_reserved_kwlist.h');
+ system('perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname UnreservedPLKeywords pl_unreserved_kwlist.h');
chdir('../../../..');
}
@@ -440,8 +440,8 @@ sub GenerateFiles
{
print "Generating c_kwlist_d.h and ecpg_kwlist_d.h...\n";
chdir('src/interfaces/ecpg/preproc');
- system('perl ../../../tools/gen_keywordlist.pl --varname ScanCKeywords c_kwlist.h');
- system('perl ../../../tools/gen_keywordlist.pl --varname ScanECPGKeywords ecpg_kwlist.h');
+ system('perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname ScanCKeywords --no-case-fold c_kwlist.h');
+ system('perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname ScanECPGKeywords ecpg_kwlist.h');
chdir('../../../..');
}