Re: PG15 beta1 sort performance regression due to Generation context change - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PG15 beta1 sort performance regression due to Generation context change
Date
Msg-id 1358573.1653347134@sss.pgh.pa.us
Whole thread Raw
In response to Re: PG15 beta1 sort performance regression due to Generation context change  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I had another, possibly-crazy idea.  I think that the API requirement
that the word before a chunk's start point to a MemoryContext is
overly strong.  What we need is that it point to something in which
a MemoryContextMethods pointer can be found (at a predefined offset).
Thus, if generation.c is willing to add the overhead of a
MemoryContextMethods pointer in GenerationBlock, it could dispense
with the per-chunk context field and just have the GenerationBlock
link there.  I guess most likely we'd also need a back-link to
the GenerationContext from GenerationBlock.  Still, two more
pointers per GenerationBlock is an easy tradeoff to make to save
one pointer per GenerationChunk.

I've not trawled the code to make sure that *only* the methods
pointer is touched by context-type-independent code, but it
seems like we could get to that even if we're not there today.

Whether this idea is something we could implement post-beta,
I'm not sure.  I'm inclined to think that we can't change the layout
of MemoryContextData post-beta, as people may already be building
extensions for production use.  We could bloat GenerationBlock even
more so that the methods pointer is at the right offset for today's
layout of MemoryContextData, though obviously going forward it'd be
better if there wasn't extra overhead needed to make this happen.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: allow building trusted languages without the untrusted versions
Next
From: Stephen Frost
Date:
Subject: Re: allow building trusted languages without the untrusted versions