Re: Use compiler intrinsics for bit ops in hash

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, Jesse Zhang <sbjesse(at)gmail(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use compiler intrinsics for bit ops in hash
Date: 2020-04-08 01:04:08
Message-ID: CAApHDvq7bh3vWFM3AXhVZxBpSFs8xYnSvQy8FyRuwMfxtukKCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 8 Apr 2020 at 01:16, John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> wrote:
>
> On Tue, Apr 7, 2020 at 8:26 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> >
> > Hi John,
> >
> > Thanks for having a look at this.
> >
> > On Wed, 8 Apr 2020 at 00:16, John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> wrote:
> > > Overall looks good to me. Just a couple things I see:
> > >
> > > It seems _hash_log2 is still in the tree, but has no callers?
> >
> > Yeah, I left it in there since it was an external function. Perhaps
> > we could rip it out and write something in the commit message that it
> > should be replaced with the newer functions. Thinking of extension
> > authors here.
>
> I'm not the best judge of where to draw the line for extensions, but
> this function does have a name beginning with an underscore, which to
> me is a red flag that it's internal in nature.

OK. I've removed that function now and stuck a note in the commit
message to mention an alternative.

> Hmm. Does pg_bitutils.h need something like this?
>
> #ifndef FRONTEND
> extern PGDLLIMPORT const uint8 pg_leftmost_one_pos[256];
> extern PGDLLIMPORT const uint8 pg_rightmost_one_pos[256];
> extern PGDLLIMPORT const uint8 pg_number_of_ones[256];
> #else
> extern const uint8 pg_leftmost_one_pos[256];
> extern const uint8 pg_rightmost_one_pos[256];
> extern const uint8 pg_number_of_ones[256];
> #endif

Yeah, looking at keywords.h, we hit this before in c2d1eea9e75. Your
proposed fix works and is the same as in keywords.h, so I've gone with
that.

I've attached v8 of the patchset.

David

Attachment Content-Type Size
v8-0001-Add-functions-to-calculate-the-next-power-of-2.patch application/octet-stream 3.0 KB
v8-0002-Modify-various-power-2-calculations-to-use-new-he.patch application/octet-stream 9.2 KB
v8-0003-Modify-additional-power-2-calculations-to-use-new.patch application/octet-stream 6.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-04-08 01:09:45 Re: [HACKERS] make async slave to wait for lsn to be replayed
Previous Message Tomas Vondra 2020-04-08 00:59:05 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions