pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Antonin Houska <ah@cybertec.at>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
Date: Wed, 10 Jul 2024 13:59:15 -0500
Message-ID: <Zo7aA2m35vGR56MN@nathan> (raw)
In-Reply-To: <36977.1720623613@antos>
References: <36977.1720623613@antos>

On Wed, Jul 10, 2024 at 05:00:13PM +0200, Antonin Houska wrote:
> I don't quite understand why TransactionIdIsCurrentTransactionId() implements
> binary search in ParallelCurrentXids "from scratch" instead of using
> bsearch().

I believe there are a number of open-coded binary searches in the tree.  My
concern with switching them to bsearch() would be the performance impact of
using a function pointer for the comparisons.  Perhaps we could add a
couple of inlined binary search implementations for common types to replace
many of the open-coded ones.

-- 
nathan





view thread (4+ messages)  latest in thread

Message-ID: <Zo7aA2m35vGR56MN@nathan>
Permalink:  ../Zo7aA2m35vGR56MN@nathan/
Also on:    postgresql.org/message-id/Zo7aA2m35vGR56MN@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, ah@cybertec.at, pgsql-hackers@lists.postgresql.org
  Subject: Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
  In-Reply-To: <Zo7aA2m35vGR56MN@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