Re: [PATCH] pg_convert improvement

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Yurii Rashkovskii <yrashk(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_convert improvement
Date: 2023-11-24 14:26:00
Message-ID: b0bfe9d0-9bd6-4c83-9953-dbf5b0b26774@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 11/24/23 3:05 PM, Yurii Rashkovskii wrote:
> Hi,
>
> I propose a patch that ensures `pg_convert` doesn't allocate and copy data when no conversion is done. It is an unnecessary overhead, especially when such conversions are done frequently and for large values.
>

+1 for the patch, I think the less is done the better.

>
> Happy to hear any feedback!
>

The patch is pretty straightforward, I just have one remark:

+ /* if no actual conversion happened, return the original string */
+ /* (we are checking pointers to strings instead of encodings because
+ `pg_do_encoding_conversion` above covers more cases than just
+ encoding equality) */

I think this could be done in one single comment and follow the preferred style
for multi-line comment, see [1].

[1]: https://www.postgresql.org/docs/current/source-format.html

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yurii Rashkovskii 2023-11-24 14:32:55 Re: [PATCH] pg_convert improvement
Previous Message Michael Paquier 2023-11-24 14:07:23 Re: Adding facility for injection points (or probe points?) for more advanced tests