Re: Use compiler intrinsics for bit ops in hash
David Fetter <david@fetter.org>
From: David Fetter <david@fetter.org>
To: John Naylor <john.naylor@2ndquadrant.com>
Cc: Jesse Zhang <sbjesse@gmail.com>, PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2020-02-28T15:13:00Z
Lists: pgsql-hackers
On Thu, Feb 27, 2020 at 02:41:49PM +0800, John Naylor wrote: > On Thu, Feb 27, 2020 at 1:56 PM David Fetter <david@fetter.org> wrote: > > [v6 set] > > Hi David, > > In 0002, the pg_bitutils functions have a test (input > 0), and the > new callers ceil_log2_* and next_power_of_2_* have asserts. That seems > backward to me. To me, too, now that you mention it. My thinking was a little fuzzed by trying to accommodate platforms with intrinsics where clz is defined for 0 inputs. > I imagine some callers of bitutils will already know the value > 0, > and it's probably good to keep that branch out of the lowest level > functions. What do you think? I don't know quite how smart compilers and CPUs are these days, so it's unclear to me how often that branch would actually happen. Anyhow, I'll get a revised patch set out later today. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Commits
-
Modify additional power 2 calculations to use new helper functions
- 02a2e8b44200 13.0 landed
-
Modify various power 2 calculations to use new helper functions
- d025cf88ba5a 13.0 landed
-
Add functions to calculate the next power of 2
- f0705bb6286d 13.0 landed
-
Move src/backend/utils/hash/hashfn.c to src/common
- 05d8449e7369 13.0 cited