Re: Change GUC hashtable to use simplehash?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Change GUC hashtable to use simplehash?
Дата
Msg-id 20231122205030.v6yllmmj6dgxpg5f@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: Change GUC hashtable to use simplehash?  (John Naylor <johncnaylorls@gmail.com>)
Ответы Re: Change GUC hashtable to use simplehash?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2023-11-21 16:42:55 +0700, John Naylor wrote:
> I get a noticeable regression in 0002, though, and I think I see why:
> 
>  guc_name_hash(const char *name)
>  {
> - uint32 result = 0;
> + const unsigned char *bytes = (const unsigned char *)name;
> + int                  blen  = strlen(name);
> 
> The strlen call required for hashbytes() is not free. The lack of
> mixing in the (probably inlined after 0001) previous hash function can
> remedied directly, as in the attached:

I doubt this is a good hashfunction. For short strings, sure, but after
that...  I don't think it makes sense to reduce the internal state of a hash
function to something this small.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: remaining sql/json patches
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Changing references of password encryption to hashing