Re: Improve CRC32C performance on SSE4.2

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: "Devulapalli, Raghuveer" <raghuveer(dot)devulapalli(at)intel(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Shankaran, Akash" <akash(dot)shankaran(at)intel(dot)com>
Subject: Re: Improve CRC32C performance on SSE4.2
Date: 2025-03-05 15:52:22
Message-ID: Z8hzNpNszv70brE9@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 05, 2025 at 08:51:21AM +0700, John Naylor wrote:
> That was my hunch too, but I wanted to be more sure, so I modified the
> benchmark so it doesn't know the address of the next calculation until
> it finishes the last calculation so we can hopefully see the latency
> caused by indirection. It also does an additional calculation on
> constant 20 bytes, like the WAL header. I also tweaked the length each
> iteration so the branch predictor maybe has a harder time predicting
> the constant 20 input. And to make it more challenging, I removed the
> part that inlined all small inputs, so it inlines only constant
> inputs:

Would you mind sharing this test? It sounds like you are running a
workload with a mix of constant/inlined calls and function pointer calls to
simulate typical usage for WAL, but I'm not 100% sure I'm understanding you
correctly.

> These are still a bit noisy, and close, but, it seems there is no
> penalty in using the function pointer as long as the header
> calculation is inlined.

These results look promising.

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-03-05 16:06:10 Should we add debug_parallel_query=regress to CI?
Previous Message Andres Freund 2025-03-05 15:51:21 Re: ci: Allow running mingw tests by default via environment variable