Re: [PATCH] avoid double scanning in function byteain

From: Stepan Neretin <slpmcf(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steven Niu <niushiji(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] avoid double scanning in function byteain
Date: 2025-07-28 06:28:35
Message-ID: CA+Yyo5TA6FQkydvXc4fZGN4ExLsQSVOrJMF3ek0UsKnsGu0Ayw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 19, 2025 at 3:48 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> I wrote:
> > I'm inclined to accept 0001, reject 0002, and move on. This doesn't
> > seem like an area that's worth a huge amount of discussion.
>
> Done that way. I made a couple more cosmetic changes and added
> test cases for the double-backslash code path (which hadn't been
> covered in byteaout either, I see now).
>
> BTW, in my hands the microbenchmark that Stepan suggested shows the
> committed version to be about 40% faster than before for long input.
> So apparently the StringInfo-ification suggested in 0002 gave back
> just about all the performance gain from 0001.
>
> regards, tom lane
>

Hi Tom,

Thanks a lot for reviewing and committing the change — much appreciated!

I agree with your rationale regarding patch 0001 vs 0002. It makes sense to
avoid the overhead of StringInfo in this context, especially given the
measurable performance benefit from the simpler approach.

One small thing: it seems the commit or diff with the final adjustments and
test additions wasn't attached or linked in the thread. Could you please
point me to the commit hash or reference? I’d love to take a look at the
final version.

Best regards,
*Stepan Neretin*

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-07-28 06:38:20 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Previous Message Michael Paquier 2025-07-28 06:18:18 Re: track generic and custom plans in pg_stat_statements