Re: tweaking perfect hash multipliers - Mailing list pgsql-hackers

From John Naylor
Subject Re: tweaking perfect hash multipliers
Date
Msg-id CACPNZCvMMj88Bsnk1k=RffW6gBw+FH7wcwCBfcKLDM=UEG2UWg@mail.gmail.com
Whole thread Raw
In response to Re: tweaking perfect hash multipliers  (John Naylor <john.naylor@2ndquadrant.com>)
List pgsql-hackers
On Tue, Mar 31, 2020 at 4:05 PM John Naylor <john.naylor@2ndquadrant.com> wrote:
>
> On Tue, Mar 31, 2020 at 2:31 AM Andres Freund <andres@anarazel.de> wrote:
> > I think the form of lea generated here is among the ones that can only
> > be executed on port 1. Whereas e.g. an register+register/immediate add
> > can be executed on four different ports.
>
> I looked into slow vs. fast leas, and I think the above are actually
> fast because they have 2 operands.

No, scratch that, it seems the two forms of lea are:

leal (,%rdx,8), %ecx
leal (%rdx,%rdx,8), %ecx

The first operand in both is the implicit zero, so with 3 and 5 we do
get the slow lea on some architectures. So I've only kept the
shift-and-add multipliers in v2. I also changed the order of iteration
of the parameters, for speed. Before, it took over 30 seconds to build
the unicode quick check tables, now it takes under 2 seconds.

--
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] Check operator when creating unique index on partition table
Next
From: Robert Haas
Date:
Subject: Re: snapshot too old issues, first around wraparound and then more.