Subject: Re: bug#78162: [PATCH] hash-table-contains-p: Avoid creating a symbol on every call

From: Daniel Mendler <[email-masked]>
Date: Wed, 30 Apr 2025 16:00:40 +0200

Pip Cet <[email-masked]> writes:

> "Daniel Mendler via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\"" <[email-masked]> writes:
>
>> Tags: patch
>>
>> For performance reasons avoid creating a symbol on every call to
>> `hash-table-contains-p'.  See also https://github.com/emacs-compat/compat/issues/71.
>
> If the performance of hash-table-contains-p is an issue, we should
> reimplement it in C, which can use magic values which aren't accessible
> from Lisp.

For a proper hash table I expect this function to be efficient and not
allocate. A magic value becomes a problem if it is actually used in
Lisp. Is this likely? This should not happen by accident, only if
`hash-table--missing` is used intentionally. Note that the actual symbol
which is used for the check is uninterned.

> Pip