pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Subject: Re: optimize atomic exchanges
Date: Thu, 30 Nov 2023 21:18:15 -0600
Message-ID: <20231201031815.GA1519459@nathanxps13> (raw)
In-Reply-To: <20231129212905.GA1258737@nathanxps13>
References: <20231129212905.GA1258737@nathanxps13>

On Wed, Nov 29, 2023 at 03:29:05PM -0600, Nathan Bossart wrote:
> I haven't done any sort of performance testing on this yet.  Some
> preliminary web searches suggest that there is unlikely to be much
> difference between cmpxchg and xchg, but presumably there's some difference
> between xchg and doing cmpxchg in a while loop (as is done in
> atomics/generic.h today).  I'll report back once I've had a chance to do
> some testing...

Some rudimentary tests show a >40% speedup with this patch on x86_64.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (8+ messages)  latest in thread

Message-ID: <20231201031815.GA1519459@nathanxps13>
Permalink:  ../20231201031815.GA1519459@nathanxps13/
Also on:    postgresql.org/message-id/20231201031815.GA1519459@nathanxps13

 · 

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, andres@anarazel.de
  Subject: Re: optimize atomic exchanges
  In-Reply-To: <20231201031815.GA1519459@nathanxps13>
  References: <20231129212905.GA1258737@nathanxps13> <20231201031815.GA1519459@nathanxps13>

* 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