Re: Avoid multiple calls to memcpy (src/backend/access/index/genam.c)

Ranier Vilela <ranier.vf@gmail.com>

From: Ranier Vilela <ranier.vf@gmail.com>
To: lakshmi <lakshmigcdac@gmail.com>
Cc: Bryan Green <dbryan.green@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-25T11:38:55Z
Lists: pgsql-hackers
Hi.

Em qua., 25 de mar. de 2026 às 08:26, lakshmi <lakshmigcdac@gmail.com>
escreveu:

>
> Hi,
>>>
>>> Thanks for the suggestion and for the earlier discussion.
>>>
>> Could you repeat the tests without enable-debug?
>>
> I repeated the tests using a non-debug (optimized) build of PostgreSQL
> (19devel), built without --enable-debug.
>
> Test setup:
>
>    -
>
>    Debian Linux (x86_64)
>    -
>
>    gcc 12.2.0
>    -
>
>    AMD Ryzen 5 7535U (6 cores / 12 threads)
>    -
>
>    pgbench scale factor 1
>    -
>
>    command: pgbench -p 55432 -d postgres -c 10 -j 4 -T 60 I ran multiple
>    iterations for both the original and patched versions and considered the
>    stable runs (excluding those affected by checkpoints).
>
> Thanks.


>
>    -
>
>    Results:
>
>    Original:
>    TPS: ~1047
>    Latency: ~9.5 ms
>
>    Patched:
>    TPS: ~1040
>    Latency: ~9.6 ms
>
>    From these runs, the results are quite close, and I didn’t observe a
>    consistent performance improvement with the patch under this workload. The
>    differences appear to be within normal run-to-run variation.
>
>  I agree.


>    -
>
>    It may be that this change has limited impact in typical cases where
>    the number of keys is small. It would be interesting to see how it behaves
>    with workloads involving larger numbers of keys or different access
>    patterns.
>
> I believe it's unnecessary; I think it's been clearly demonstrated that
there has been no improvement, so it's not worth it.


>    -
>
>    Please let me know if you’d like me to try any additional scenarios.
>
> Thank you for testing.

For me, the lesson here is that this is the first time I've seen that
unloop doesn't work any better.

best regards,
Ranier Vilela