agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Antonin Houska <[email protected]>
Cc: [email protected]
Subject: Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
Date: Fri, 12 Jul 2024 10:58:30 -0500
Message-ID: <ZpFSpuCkAM5_urg8@nathan> (raw)
In-Reply-To: <47366.1720778471@antos>
References: <36977.1720623613@antos>
	<Zo7aA2m35vGR56MN@nathan>
	<47366.1720778471@antos>

On Fri, Jul 12, 2024 at 12:01:11PM +0200, Antonin Houska wrote:
> Nathan Bossart <[email protected]> wrote:
>> 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.
> 
> bsearch() appears to be used widely, but o.k., I don't insist on using it to
> replace the existing open-coded searches.

Sorry, I didn't mean to say that I was totally against switching to
bsearch(), but I do think we need to understand whether there is any
performance impact before doing so, especially in hot paths.  It would be
nice if we could reduce the number of open-coded binary searches in some
fashion, and if we can maintain or improve performance by creating a
handful of static inline functions, that would be even better.  If there's
no apparent performance difference, bsearch() is probably fine.

-- 
nathan






view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Missed opportunity for bsearch() in TransactionIdIsCurrentTransactionId()?
  In-Reply-To: <ZpFSpuCkAM5_urg8@nathan>

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

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