Re: Change GUC hashtable to use simplehash?

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: John Naylor <johncnaylorls@gmail.com>, Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Gurjeet Singh <gurjeet@singh.im>, pgsql-hackers@postgresql.org
Date: 2023-12-03T21:16:20Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Silence warning in older versions of Valgrind

  2. Revert "Speed up tail processing when hashing aligned C strings, take two"

  3. Speed up tail processing when hashing aligned C strings, take two

  4. Teach fasthash_accum to use platform endianness for bytewise loads

  5. Add macro to disable address safety instrumentation

  6. Convert uses of hash_string_pointer to fasthash equivalent

  7. Speed up tail processing when hashing aligned C strings

  8. Add helper functions for dshash tables with string keys.

  9. Fix warnings in cpluspluscheck

  10. Further cosmetic review of hashfn_unstable.h

  11. Simplify initialization of incremental hash state

  12. Add optimized C string hashing

  13. Add inline incremental hash functions for in-memory use

  14. Make all Perl warnings fatal

On Wed, 2023-11-29 at 20:31 +0700, John Naylor wrote:
> v5-0001 puts fash-hash as-is into a new header, named in a way to
> convey in-memory use e.g. hash tables.
> 
> v5-0002 does the minimal to allow dynash to use this for string_hash,
> inlined but still calling strlen.
> 
> v5-0003 shows one way to do a incremental interface. It might be okay
> for simplehash with fixed length keys, but seems awkward for strings.
> 
> v5-0004 shows a bytewise incremental interface, with implementations
> for dynahash (getting rid of strlen) and guc hash.

I'm trying to follow the distinctions you're making between dynahash
and simplehash -- are you saying it's easier to do incremental hashing
with dynahash, and if so, why?

If I understood what Andres was saying, the exposed hash state would be
useful for writing a hash function like guc_name_hash(). But whether we
use simplehash or dynahash is a separate question, right?

Also, while the |= 0x20 is a nice trick for lowercasing, did we decide
that it's better than my approach in patch 0004 here:

https://www.postgresql.org/message-id/27a7a289d5b8f42e1b1e79b1bcaeef3a40583bd2.camel@j-davis.com

which optimizes exact hits (most GUC names are already folded) before
trying case folding?

Regards,
	Jeff Davis