projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
77659bd
)
Optimise `apply` with `cons` in tail argument
author
Mattias Engdegård
<mattiase@acm.org>
Thu, 12 Jan 2023 13:07:45 +0000
(14:07 +0100)
committer
Mattias Engdegård
<mattiase@acm.org>
Mon, 16 Jan 2023 18:42:31 +0000
(19:42 +0100)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-apply): Transform
(apply F ... (cons X Y)) -> (apply F ... X Y)
This pattern is seen both in hand-written code and in backquote
expansions.
lisp/emacs-lisp/byte-opt.el
patch
|
blob
|
history
diff --git
a/lisp/emacs-lisp/byte-opt.el
b/lisp/emacs-lisp/byte-opt.el
index d7a0d851e01709b14bddcc90681f2135935c4c3e..039cebedb44213eaf7e893e2c3834cd5f0e00674 100644
(file)
--- a/
lisp/emacs-lisp/byte-opt.el
+++ b/
lisp/emacs-lisp/byte-opt.el
@@
-1380,6
+1380,9
@@
See Info node `(elisp) Integer Basics'."
;; (apply F ... (list X Y ...)) -> (funcall F ... X Y ...)
((eq (car-safe last) 'list)
`(funcall ,fn ,@(butlast (cddr form)) ,@(cdr last)))
+ ;; (apply F ... (cons X Y)) -> (apply F ... X Y)
+ ((eq (car-safe last) 'cons)
+ (append (butlast form) (cdr last)))
(t form)))
form)))