Re: Make printtup a bit faster - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Make printtup a bit faster
Date
Msg-id 877cbyizxp.fsf@163.com
Whole thread Raw
In response to Make printtup a bit faster  (Andy Fan <zhihuifan1213@163.com>)
Responses Re: Make printtup a bit faster
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:

> On Fri, 30 Aug 2024 at 12:10, Andy Fan <zhihuifan1213@163.com> wrote:
>> What would be the extra benefit we redesign all the out functions?
>
> If I've understood your proposal correctly, it sounds like you want to
> invent a new "print" output function for each type to output the Datum
> onto a StringInfo,

Mostly yes, but not for [each type at once], just for the [common used
type], like int2/4/8, float4/8, date/time/timestamp, text/.. and so on.

> if that's the case, what would be the point of having both versions?

The biggest benefit would be compatibility.

In my opinion, print function (not need to be in pg_type at all) is as
an optimization and optional, in some performance critical path we can
replace the out-function with printfunction, like (printtup). if such
performance-critical path find a type without a print-function is
defined, just keep the old way.

Kind of like supportfunction for proc, this is for data type? Within
this way, changes would be much smaller and step-by-step.

> If there's anywhere we call output functions
> where the resulting value isn't directly appended to a StringInfo,
> then we could just use a temporary StringInfo to obtain the cstring
> and its length.

I think this is true, but it requests some caller's code change.

-- 
Best Regards
Andy Fan




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Make printtup a bit faster
Next
From: David Rowley
Date:
Subject: Re: Make printtup a bit faster