Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()? - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
Date
Msg-id Zo7aA2m35vGR56MN@nathan
Whole thread Raw
In response to Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?  (Antonin Houska <ah@cybertec.at>)
Responses Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
List 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



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal
Next
From: Jeff Davis
Date:
Subject: Re: pg_maintain and USAGE privilege on schema