Re: Division in dynahash.c due to HASH_FFACTOR - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Division in dynahash.c due to HASH_FFACTOR
Date
Msg-id 603568.1600479056@sss.pgh.pa.us
Whole thread Raw
In response to Re: Division in dynahash.c due to HASH_FFACTOR  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Division in dynahash.c due to HASH_FFACTOR  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
I wrote:
> ISTM that getting rid of the division obviates the concern that the
> nentries condition is too expensive,

Also, we could make it slightly cheaper yet, by changing the condition
to

            hctl->freeList[0].nentries > (long) (hctl->max_bucket)

ie drop the +1.  I'd argue that this is actually a more faithful
rendition of the previous condition, since what we had before was
basically

            hctl->freeList[0].nentries >= (long) (hctl->max_bucket + 1)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Division in dynahash.c due to HASH_FFACTOR
Next
From: Michael Paquier
Date:
Subject: Re: pg_logging_init() can return ENOTTY with TAP tests