diff options
author | Nicolas Petton <nicolas@petton.fr> | 2015-04-29 19:01:56 +0200 |
---|---|---|
committer | Nicolas Petton <nicolas@petton.fr> | 2015-04-29 19:05:44 +0200 |
commit | a5237a049981dbad2ecc3b17d47257ce164a8e70 (patch) | |
tree | ed445298b36f0b0e7b922f4e97f64dbe7533fb8d | |
parent | 12a3ea52c4d5e3a62af5f8eaaa2df7f2e4b66da2 (diff) | |
download | emacs-map.tar.gz |
Faster implementation of map-empty-pmap
* lisp/emacs-lisp/map.el (map-empty-p): Faster implementation using
specific tests depending on the type of the map.
-rw-r--r-- | lisp/emacs-lisp/map.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index ff0dc120c8a..18d2963f46c 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -150,7 +150,11 @@ FUNCTION is called with two arguments, the key and the value." (arrayp map))) (defun map-empty-p (map) - (null (map-keys map))) + "Return non-nil is MAP is empty." + (map--dispatch map + :list (null map) + :array (seq-empty-p map) + :hash-table (zerop (hash-table-count map)))) (defun map-contains-key-p (map key &optional testfn) "Return non-nil if MAP contain the key KEY, nil otherwise. |