mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-07 15:00:34 -08:00
Slightly faster hash-table-keys and hash-table-values
* lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Omit the reversal of the returned list. It is not ordered anyway. * test/lisp/emacs-lisp/subr-x-tests.el (subr-x--hash-table-keys-and-values): New test.
This commit is contained in:
parent
a203ad5ed0
commit
4311bd0bd7
2 changed files with 13 additions and 2 deletions
|
|
@ -87,11 +87,15 @@ threading."
|
|||
|
||||
(defsubst hash-table-keys (hash-table)
|
||||
"Return a list of keys in HASH-TABLE."
|
||||
(cl-loop for k being the hash-keys of hash-table collect k))
|
||||
(let ((keys nil))
|
||||
(maphash (lambda (k _) (push k keys)) hash-table)
|
||||
keys))
|
||||
|
||||
(defsubst hash-table-values (hash-table)
|
||||
"Return a list of values in HASH-TABLE."
|
||||
(cl-loop for v being the hash-values of hash-table collect v))
|
||||
(let ((values nil))
|
||||
(maphash (lambda (_ v) (push v values)) hash-table)
|
||||
values))
|
||||
|
||||
(defsubst string-empty-p (string)
|
||||
"Check whether STRING is empty."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue