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

From John Naylor
Subject Re: tweaking perfect hash multipliers
Date
Msg-id CACPNZCuSmUXh-xjOUtKQYtJRiPf45_KhVcM6P_ExDv+VW0T_UA@mail.gmail.com
Whole thread Raw
In response to Re: tweaking perfect hash multipliers  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Tue, Mar 31, 2020 at 2:31 AM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2020-03-30 21:33:14 +0800, John Naylor wrote:
> > Then I used the attached program to measure various combinations of
> > compiled instructions using two constant multipliers iterating over
> > bytes similar to a generated hash function.
>
> It looks like you didn't attach the program?

Funny, I did, but then decided to rename the files. Here they are. I
tried to make the loop similar to how it'd be in the actual hash
function, but leaving out the post-loop modulus and array access. Each
loop iteration is dependent on the last one's result.

> It's a bit complicated by the fact that there's more execution ports to
> execute shift/add than there ports to compute some form of leas. And
> some of that won't easily be measurable in a micro-benchmark, because
> there'll be dependencies between the instruction preventing any
> instruction level parallelism.
>
> 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.

That's interesting, I'll have to look into that.

Thanks for the info!

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

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] remove condition always true(/src/backend/access/heap/vacuumlazy.c)
Next
From: Andres Freund
Date:
Subject: Re: backup manifests