pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Fetter <david@fetter.org>
To: John Naylor <john.naylor@2ndquadrant.com>
Cc: Jesse Zhang <sbjesse@gmail.com>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Subject: Re: Use compiler intrinsics for bit ops in hash
Date: Fri, 28 Feb 2020 16:13:00 +0100
Message-ID: <20200228151259.GM13804@fetter.org> (raw)
In-Reply-To: <CACPNZCuvUN1cFKNHhqM-mZS2t-0N1ZQdn5pOeubtfj3ya1o61w@mail.gmail.com>
References: <20200114173553.GE32763@fetter.org>
	<CAGf+fX79VCypUUuJTbf8o1no3Sqay1tHKVsnYAEN8wvDp2_eqA@mail.gmail.com>
	<20200114220917.GG32763@fetter.org>
	<CAGf+fX4nqk4utcdC3ZGRFA-xcU4=JZ+rE_Zq3ex+pLCsi=8soA@mail.gmail.com>
	<20200131155918.GI24870@fetter.org>
	<20200226081223.GI13804@fetter.org>
	<20200227055640.GL13804@fetter.org>
	<CACPNZCuvUN1cFKNHhqM-mZS2t-0N1ZQdn5pOeubtfj3ya1o61w@mail.gmail.com>

On Thu, Feb 27, 2020 at 02:41:49PM +0800, John Naylor wrote:
> On Thu, Feb 27, 2020 at 1:56 PM David Fetter <david@fetter.org> wrote:
> > [v6 set]
> 
> Hi David,
> 
> In 0002, the pg_bitutils functions have a test (input > 0), and the
> new callers ceil_log2_* and next_power_of_2_* have asserts. That seems
> backward to me.

To me, too, now that you mention it.  My thinking was a little fuzzed
by trying to accommodate platforms with intrinsics where clz is
defined for 0 inputs.

> I imagine some callers of bitutils will already know the value > 0,
> and it's probably good to keep that branch out of the lowest level
> functions. What do you think?

I don't know quite how smart compilers and CPUs are these days, so
it's unclear to me how often that branch would actually happen.

Anyhow, I'll get a revised patch set out later today.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate





view thread (29+ messages)  latest in thread

Message-ID: <20200228151259.GM13804@fetter.org>
Permalink:  ../20200228151259.GM13804@fetter.org/
Also on:    postgresql.org/message-id/20200228151259.GM13804@fetter.org

 · 

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: david@fetter.org, john.naylor@2ndquadrant.com, sbjesse@gmail.com
  Subject: Re: Use compiler intrinsics for bit ops in hash
  In-Reply-To: <20200228151259.GM13804@fetter.org>

* 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