pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: Devulapalli, Raghuveer <raghuveer.devulapalli@intel.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Shankaran, Akash <akash.shankaran@intel.com>
Subject: Re: Improve CRC32C performance on SSE4.2
Date: Wed, 5 Mar 2025 09:52:22 -0600
Message-ID: <Z8hzNpNszv70brE9@nathan> (raw)
In-Reply-To: <CANWCAZYRhLHArpyfV4uRK-Rw9N5oV5HMkkKtBehcuTjNOMwCZg@mail.gmail.com>
References: <PH8PR11MB82867CEDDECB60530DB96BD1FBC22@PH8PR11MB8286.namprd11.prod.outlook.com>
	<CANWCAZbG_pPFuLRaczYApBykaHCXQ-STAXO1=J6_4TRvy23Byg@mail.gmail.com>
	<PH8PR11MB8286B017901C2C30665B106CFBC22@PH8PR11MB8286.namprd11.prod.outlook.com>
	<CANWCAZZjuH8daxK-tcnYbK_sAQdq8R6d3T3iGfL43Dj6DkFv0g@mail.gmail.com>
	<PH8PR11MB82862B464609340FB0A4BA37FBCD2@PH8PR11MB8286.namprd11.prod.outlook.com>
	<CANWCAZZEiTzhZcuwTiJ2=opiNpAUn1vuDRu1N02z61AthwRZLA@mail.gmail.com>
	<Z8X-0wg7wXztjMQ2@nathan>
	<CANWCAZbAvNB5cuht8T5wuap6JjwUaqyCezE+U5r4GhWYGYkmWw@mail.gmail.com>
	<Z8c6Cfp-XIiJtGB5@nathan>
	<CANWCAZYRhLHArpyfV4uRK-Rw9N5oV5HMkkKtBehcuTjNOMwCZg@mail.gmail.com>

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





view thread (82+ messages)  latest in thread

Message-ID: <Z8hzNpNszv70brE9@nathan>
Permalink:  ../Z8hzNpNszv70brE9@nathan/
Also on:    postgresql.org/message-id/Z8hzNpNszv70brE9@nathan

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, johncnaylorls@gmail.com, raghuveer.devulapalli@intel.com, akash.shankaran@intel.com
  Subject: Re: Improve CRC32C performance on SSE4.2
  In-Reply-To: <Z8hzNpNszv70brE9@nathan>
  References: <PH8PR11MB82867CEDDECB60530DB96BD1FBC22@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZbG_pPFuLRaczYApBykaHCXQ-STAXO1=J6_4TRvy23Byg@mail.gmail.com> <PH8PR11MB8286B017901C2C30665B106CFBC22@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZZjuH8daxK-tcnYbK_sAQdq8R6d3T3iGfL43Dj6DkFv0g@mail.gmail.com> <PH8PR11MB82862B464609340FB0A4BA37FBCD2@PH8PR11MB8286.namprd11.prod.outlook.com> <CANWCAZZEiTzhZcuwTiJ2=opiNpAUn1vuDRu1N02z61AthwRZLA@mail.gmail.com> <Z8X-0wg7wXztjMQ2@nathan> <CANWCAZbAvNB5cuht8T5wuap6JjwUaqyCezE+U5r4GhWYGYkmWw@mail.gmail.com> <Z8c6Cfp-XIiJtGB5@nathan> <CANWCAZYRhLHArpyfV4uRK-Rw9N5oV5HMkkKtBehcuTjNOMwCZg@mail.gmail.com> <Z8hzNpNszv70brE9@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox