1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Further seq-uniq speed-ups for lists

* lisp/emacs-lisp/seq.el (seq-uniq): Speed up more for long lists
(bug#57079).
This commit is contained in:
Lars Ingebrigtsen 2022-08-12 15:15:11 +02:00
parent f947b20a19
commit c0d761bf7f
2 changed files with 21 additions and 6 deletions

View file

@ -570,7 +570,12 @@ Evaluate BODY for each created sequence.
(substring "2")
(substring "1"))))
(should (equal (seq-uniq list) '("1" "2" "3")))
(should (equal (seq-uniq list #'eq) '("1" "2" "3" "2" "1")))))
(should (equal (seq-uniq list #'eq) '("1" "2" "3" "2" "1"))))
;; Long lists have a different code path.
(let ((list (seq-map-indexed (lambda (_ i) i)
(make-list 10000 nil))))
(should (= (length list) 10000))
(should (= (length (seq-uniq (append list list))) 10000))))
(provide 'seq-tests)
;;; seq-tests.el ends here