Re: tweaking perfect hash multipliers

From: John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tweaking perfect hash multipliers
Date: 2020-04-01 18:54:43
Message-ID: CACPNZCvMMj88Bsnk1k=RffW6gBw+FH7wcwCBfcKLDM=UEG2UWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 31, 2020 at 4:05 PM John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> wrote:
>
> On Tue, Mar 31, 2020 at 2:31 AM Andres Freund <andres(at)anarazel(dot)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 Content-Type Size
v2-tweak-perfect-hash-gen.patch application/octet-stream 1.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-04-01 19:02:28 Re: snapshot too old issues, first around wraparound and then more.
Previous Message Tom Lane 2020-04-01 18:53:09 Re: [PATCH] Check operator when creating unique index on partition table