Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
Date: 2024-07-10 18:59:15
Message-ID: Zo7aA2m35vGR56MN@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2024-07-10 19:29:00 Re: pg_maintain and USAGE privilege on schema
Previous Message Nathan Bossart 2024-07-10 18:41:41 Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal