Re: small pg_dump code cleanup

From: Neil Conway <neil(dot)conway(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: small pg_dump code cleanup
Date: 2024-06-05 17:51:08
Message-ID: CAOW5sYZtaR=QP4Ygc_gDvUrFwas1xmZR4yQbNCuYjHrcd066yA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 5, 2024 at 12:37 PM Nathan Bossart <nathandbossart(at)gmail(dot)com>
wrote:

> What about collectXXX() to match similar functions in pg_dump.c (e.g.,
> collectRoleNames(), collectComments(), collectSecLabels())?
>

sgtm.

> > (2) These functions malloc() a single ntups * sizeof(struct) allocation
> and
> > then index into it to fill-in each struct before entering it into the
> hash
> > table. It might be more straightforward to just malloc each individual
> > struct.
>
> That'd increase the number of allocations quite significantly, but I'd be
> surprised if that was noticeable outside of extreme scenarios. At the
> moment, I'm inclined to leave these as-is for this reason and because I
> doubt it'd result in much cleanup, but I'll yield to the majority opinion
> here.
>

As you say, I'd be surprised if the performance difference is noticeable.
Personally I don't think the marginal performance win justifies the hit to
readability, but I don't feel strongly about it.

Neil

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2024-06-05 17:53:31 Re: Extension security improvement: Add support for extensions with an owned schema
Previous Message Jelte Fennema-Nio 2024-06-05 17:49:58 Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs