Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: John Naylor <jcnaylor@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, Andrew Gierth <andrew@tao11.riddles.org.uk>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2018-12-27T20:34:13Z
Lists: pgsql-hackers
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 12/27/18 3:00 PM, John Naylor wrote:
>> This style was cargo-culted from the catalog scripts. I can settle on
>> just the first form if you like.

> I would rather we used the standard perl module Getopt::Long, as
> numerous programs we have already do.

Hmm ... grepping finds that used only in

src/tools/pgindent/pgindent
src/tools/git_changelog
src/pl/plperl/text2macro.pl

so I'm not quite sure about the "numerous" claim.  Adopting that
here would possibly impose the requirement of having Getopt::Long
on some developers who are getting by without it today.  However,
that's a pretty thin argument, and if Getopt::Long is present even
in the most minimal Perl installations then it's certainly moot.

On the whole I'm +1 for this.  Perhaps also, as an independent patch,
we should change the catalog scripts to use Getopt::Long.

			regards, tom lane


Commits

  1. Use perfect hashing, instead of binary search, for keyword lookup.

  2. Reduce the size of the fmgr_builtin_oid_index[] array.

  3. Replace the data structure used for keyword lookup.