| From: | John Naylor <jcnaylor(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: reducing the footprint of ScanKeyword (was Re: Large writable variables) |
| Date: | 2018-12-20 00:42:17 |
| Message-ID: | CAJVSVGXsY_HQ8TUt--PXiE0U9A6JqS+C7HqatR6h-ukQOE0ATA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 12/18/18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I'd be kind of inclined to convert all uses of ScanKeyword to the new way,
> if only for consistency's sake. On the other hand, I'm not the one
> volunteering to do the work.
That's reasonable, as long as the design is nailed down first. Along
those lines, attached is a heavily WIP patch that only touches plpgsql
unreserved keywords, to test out the new methodology in a limited
area. After settling APIs and name/directory bikeshedding, I'll move
on to the other four keyword types.
There's a new Perl script, src/common/gen_keywords.pl, which takes
pl_unreserved_kwlist.h as input and outputs
pl_unreserved_kwlist_offset.h and pl_unreserved_kwlist_string.h. The
output headers are not installed or symlinked anywhere. Since the
input keyword lists will never be #included directly, they might be
better as .txt files, like errcodes.txt. If we went that far, we might
also remove the PG_KEYWORD macros (they'd still be in the output
files) and rename parser/kwlist.h to common/core_kwlist.txt. There's
also a case for not changing things unnecessarily, especially if
there's ever a new reason to include the base keyword list directly.
To keep the other keyword types functional, I had to add a separate
new struct ScanKeywordOffset and new function
ScanKeywordLookupOffset(), so the patch is a bit messier than the
final will be. With a 4-byte offset, ScankeyWordOffset is 8 bytes,
down from 12, and is now a power of 2.
I used the global .gitignore, but maybe that's an abuse of it.
Make check passes, but I don't know how well it stresses keyword use.
I'll create a commitfest entry soon.
-John Naylor
| Attachment | Content-Type | Size |
|---|---|---|
| wip-01-use-offset-based-scankeywords.patch | text/x-patch | 21.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Gierth | 2018-12-20 00:54:39 | Re: reducing the footprint of ScanKeyword (was Re: Large writable variables) |
| Previous Message | Michael Paquier | 2018-12-20 00:40:49 | Re: Postgres Replication Issue |