diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-15 10:48:37 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-15 11:19:51 -0700 |
commit | b467bb531e1ab0eed57e1889004d2115e80e4292 (patch) | |
tree | 844d23f28d438f66dd8659dec46baf081722888f /test/src | |
parent | e97def2bbce7777d3afc916a5aa4d951fab5f3f4 (diff) | |
download | emacs-b467bb531e1ab0eed57e1889004d2115e80e4292.tar.gz |
Minimize ‘equal’ calls in (delete x vector)
* src/fns.c (Fdelete): When deleting from a vector, call Fequal
only once per vector element. This is faster when Fequal is slow,
and avoids the need to preinitialize the vector result. Finish
when the result is exhausted, not when the input is exhausted;
the two are equivalent but the former may be faster.
* test/src/fns-tests.el (test-vector-delete): New test.
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/fns-tests.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index f1faf58659a..141de1d226c 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -895,3 +895,8 @@ ;; This does not test randomness; it's merely a format check. (should (string-match "\\`[0-9a-f]\\{128\\}\\'" (secure-hash 'sha512 'iv-auto 100)))) + +(ert-deftest test-vector-delete () + (let ((v1 (make-vector 1000 1))) + (should (equal (delete 1 v1) (vector))) + (should (equal (delete 2 v1) v1)))) |