diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-01-04 13:14:32 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-01-04 13:14:32 +0100 |
commit | 8e3868125c902f1864a32d817f34e3dfc4eea9a9 (patch) | |
tree | 6ac36e3d9939e88f1fb37c74904f7a8272032f65 /lisp/emacs-lisp | |
parent | fb38d367f4a46c580510f8a6510ae8fb5f39222f (diff) | |
download | emacs-8e3868125c902f1864a32d817f34e3dfc4eea9a9.tar.gz emacs-8e3868125c902f1864a32d817f34e3dfc4eea9a9.tar.bz2 emacs-8e3868125c902f1864a32d817f34e3dfc4eea9a9.zip |
Generate fewer useless conditionals in cl-loop
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
Don't generate a condition if both branches are the same, which
is the common case.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c4f69120ff7..9d0fd15bc3d 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1318,7 +1318,10 @@ For more details, see Info node `(cl)Loop Facility'. (nreverse cl--loop-conditions))) ,then ,var)) loop-for-steps)) - (push `(,var (if ,first-assign ,start ,then)) loop-for-sets)))) + (push (if (eq start then) + `(,var ,then) + `(,var (if ,first-assign ,start ,then))) + loop-for-sets)))) ((memq word '(across across-ref)) (let ((temp-vec (make-symbol "--cl-vec--")) |