Re: Allow simplehash to use already-calculated hash values

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allow simplehash to use already-calculated hash values
Date: 2019-07-17 19:59:36
Message-ID: 6a3c0f1a70ee4e8571bbc69a8f3a908ac424d7f7.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2019-07-17 at 11:59 -0700, Andres Freund wrote:
> I've not tested it, but this looks reasonable to me. Do you actually
> need the lookup variant, or is that more for completeness?

Yes. If the hash table is full, I do a lookup. If not, I do an insert.

> nitpick^3: I'd s/This is intended for use/The immediate use-case is/

OK.

> > +static inline SH_ELEMENT_TYPE *
> > +SH_INSERT_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32
> > hash, bool *found)
>
> I'd perhaps add a comment here along the lines of:
>
> /*
> * This is a separate static inline function, so it can be reliably
> be inlined
> * into its wrapper functions even if SH_SCOPE is extern.
> */

Will do.

Regards,
Jeff

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ryan Lambert 2019-07-17 20:06:47 Re: FETCH FIRST clause PERCENT option
Previous Message Tom Lane 2019-07-17 19:01:29 Re: Change ereport level for QueuePartitionConstraintValidation