On Fri, 16 Oct 2026 at 01:16, Chao Li <[email protected]> wrote:
> I tried StringInfo first. A few minor reasons led me to choose the v1 
> approach:
>
> * v1 made fewer changes to the existing code.
> * v1 was slightly faster in my test. With debug and assertions disabled, v1 
> took about 20 ms and StringInfo about 24 ms, averaged over multiple runs.

I doubt that matters very much. I think your test case isn't that
realistic anyway, as it uses InvalidOid. I tried exercising it with:
SELECT length(oidvectortypes(repeat('1043 ', 100)::oidvector));

Which gives:

master: tps = 9427.119361
v1: tps = 9684.447542
v2: tps = 9681.868182
v2b: tps = 9707.819189

v2b just replaces the appendStringInfoString(&result, ", "); with
appendBinaryStringInfo(&result, ", ", 2);

> I agree that using the usual API outweigh these minor considerations. I've 
> updated the patch to use StringInfo in v2.

v2 looks fine to me.

David


Reply via email to