From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Shankar Rao <shankar.rao@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Is there utility in making hash-table-{keys, values} built-in functions?
Date: Thu, 28 Nov 2024 18:31:06 +0100 [thread overview]
Message-ID: <B0916A03-E1CC-4936-965A-12DCDE9CBE73@gmail.com> (raw)
In-Reply-To: <CAGEgU=gaGaN4QOt1s83xmJEJ1eJW1xqd94pE544ecPVuNb6Hew@mail.gmail.com>
28 nov. 2024 kl. 12.53 skrev Shankar Rao <shankar.rao@gmail.com>:
> I noticed that the functions hash-table-keys and hash-table-values are just wrappers around maphash. This means that there is no way to iterate over a hash-table without using a lambda.
>
> Would it be useful or worthwhile to implement these directly in C? I don't know much about low-level Emacs development, but having these as built-ins could make iteration of a hash-table a little faster and easier to debug.
It's unlikely that it would be faster to make a list just for the purpose of a single iteration; the allocation costs alone would be too high. Other ways of iterating through hash-tables have been tried with mostly disappointing results, although there might be some value in avoiding use of the C stack in some cases.
If you tell us what you are trying to accomplish, it would be easier for us to help you.
next prev parent reply other threads:[~2024-11-28 17:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 11:53 Is there utility in making hash-table-{keys, values} built-in functions? Shankar Rao
2024-11-28 17:31 ` Mattias Engdegård [this message]
2024-11-28 18:40 ` Gerd Möllmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B0916A03-E1CC-4936-965A-12DCDE9CBE73@gmail.com \
--to=mattias.engdegard@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=shankar.rao@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).