Re: [PATCH] avoid double scanning in function byteain

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steven Niu <niushiji@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>, Stepan Neretin <slpmcf@gmail.com>, Kirill Reshke <reshkekirill@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-07-18T20:48:08Z
Lists: pgsql-hackers
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



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Speed up byteain by not parsing traditional-style input twice.