[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9a54e70 1/2: Optimize byte-compilation of proper-li
From: |
Basil L. Contovounesios |
Subject: |
[Emacs-diffs] master 9a54e70 1/2: Optimize byte-compilation of proper-list-p |
Date: |
Fri, 12 Apr 2019 09:28:35 -0400 (EDT) |
branch: master
commit 9a54e70c184cd9f65f1141a1b1df87e9afb83d2f
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>
Optimize byte-compilation of proper-list-p
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00316.html
* lisp/emacs-lisp/byte-opt.el: Optimize proper-list-p as a
predicate.
* lisp/subr.el: Mark proper-list-p as pure, and side-effect and
error free.
---
lisp/emacs-lisp/byte-opt.el | 3 ++-
lisp/subr.el | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 33d4964..44cca61 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -879,7 +879,8 @@
(put 'symbolp 'byte-optimizer 'byte-optimize-predicate)
(put 'stringp 'byte-optimizer 'byte-optimize-predicate)
(put 'string< 'byte-optimizer 'byte-optimize-predicate)
-(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate)
+(put 'string-lessp 'byte-optimizer 'byte-optimize-predicate)
+(put 'proper-list-p 'byte-optimizer 'byte-optimize-predicate)
(put 'logand 'byte-optimizer 'byte-optimize-predicate)
(put 'logior 'byte-optimizer 'byte-optimize-predicate)
diff --git a/lisp/subr.el b/lisp/subr.el
index bdf9897..bf3716b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -604,6 +604,11 @@ If N is omitted or nil, remove the last element."
(if (> n 0) (setcdr (nthcdr (- (1- m) n) list) nil))
list))))
+;; The function's definition was moved to fns.c,
+;; but it's easier to set properties here.
+(put 'proper-list-p 'pure t)
+(put 'proper-list-p 'side-effect-free 'error-free)
+
(defun delete-dups (list)
"Destructively remove `equal' duplicates from LIST.
Store the result in LIST and return it. LIST must be a proper list.