From: | John Naylor <john(dot)naylor(at)2ndquadrant(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | David Fetter <david(at)fetter(dot)org>, Jesse Zhang <sbjesse(at)gmail(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Use compiler intrinsics for bit ops in hash |
Date: | 2020-04-07 12:16:47 |
Message-ID: | CACPNZCspPVKBYXHx9H-FjJ_kBgLjB_UfYtLduHC6AchqVBDjgw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Apr 7, 2020 at 7:41 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> I've attached an updated patch. It includes the modifications
> mentioned above to pre-check for a power of 2 number with the bit
> masking hack mentioned above. I also renamed the functions to be more
> aligned to the other functions in pg_bitutils.h I'm not convinced
> pg_ceil_log2_* needs the word "ceil" in there.
>
> I dropped the part of the patch that was changing longs to ints of a
> known size. I went on and did some additional conversion in the 0003
> patch. There are more laying around the code base, but I ended up
> finding a bit to fix up than i had thought I would. e.g. various
> places that repalloc() inside a loop that is multiplying the
> allocation size by 2 each time. The repalloc should be done at the
> end, not during the loop. I thought I might come back to those some
> time in the future.
>
> Is anyone able to have a look at this?
>
> David
Hi David,
Overall looks good to me. Just a couple things I see:
It seems _hash_log2 is still in the tree, but has no callers?
- max_size = 8; /* semi-arbitrary small power of 2 */
- while (max_size < min_size + LIST_HEADER_OVERHEAD)
- max_size *= 2;
+ max_size = pg_nextpower2_32(Max(8, min_size + LIST_HEADER_OVERHEAD));
Minor nit: We might want to keep the comment that the number is
"semi-arbitrary" here as well.
- 'pg_waldump', 'scripts');
+ 'pg_validatebackup', 'pg_waldump', 'scripts');
This seems like a separate concern?
--
John Naylor https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2020-04-07 12:18:51 | Re: Improving connection scalability: GetSnapshotData() |
Previous Message | Alexander Korotkov | 2020-04-07 12:16:09 | Re: [HACKERS] make async slave to wait for lsn to be replayed |