1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 14:30:43 -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:
Mattias Engdegård 2022-06-17 19:13:33 +02:00
parent a203ad5ed0
commit 4311bd0bd7
2 changed files with 13 additions and 2 deletions

View file

@ -743,6 +743,13 @@
(with-current-buffer inner
(should-not (buffer-modified-p))))))))
(ert-deftest subr-x--hash-table-keys-and-values ()
(let ((h (make-hash-table)))
(puthash 'a 1 h)
(puthash 'c 3 h)
(puthash 'b 2 h)
(should (equal (sort (hash-table-keys h) #'string<) '(a b c)))
(should (equal (sort (hash-table-values h) #'<) '(1 2 3)))))
(provide 'subr-x-tests)
;;; subr-x-tests.el ends here