Re: Experimenting with hash tables inside pg_dump - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Experimenting with hash tables inside pg_dump
Date
Msg-id 0D54435C-1199-4361-9D74-2FBDCF8EA164@anarazel.de
Whole thread Raw
In response to Re: Experimenting with hash tables inside pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Experimenting with hash tables inside pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

On October 22, 2021 10:32:30 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Andres Freund <andres@anarazel.de> writes:
>>> On 2021-10-21 18:27:25 -0400, Tom Lane wrote:
>>>> (a) the executable size increases by a few KB --- apparently, even
>>>> the minimum subset of simplehash.h's functionality is code-wasteful.
>
>> If I prevent the compiler from inlining findObjectByCatalogId() in all the
>> find*ByOid() routines, your version is smaller than master even without other
>> changes.
>
>Hmm ... seems to depend a lot on which compiler you use.

Inline heuristics change a lot over time, so that'd make sense.

I see some win by marking pg_log_error cold. That might be useful more generally too.


Which made me look at the code invoking it from simplehash. I think the patch that made simplehash work in frontend
codeisn't quite right, because pg_log_error() returns... 


Wonder if we should mark simplehash's grow as noinline? Even with a single caller it seems better to not inline it to
removeregister allocator pressure. 


>Anyway, these are all sub-one-percent changes in the code
>size, so probably we should not sweat that much about it.
>I'm kind of leaning now towards pushing the patch, just
>on the grounds that getting rid of all those single-purpose
>index arrays (and likely future need for more of them)
>is worth it from a maintenance perspective.

+1

The only thought I had wrt the patch is that I'd always create the hash table. That way the related branches can be
removed,which is a win code size wise (as well as speed presumably, but I think we're far away from that mattering). 


This type of code is where I most wish for a language with proper generic data types/containers...

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Experimenting with hash tables inside pg_dump
Next
From: Mikhail
Date:
Subject: Re: [PATCH] Make ENOSPC not fatal in semaphore creation