comparison lisp/cl-macs.el @ 5266:f9ec07abdbf9

Transform safe calls to (= X Y Z) to (and (= X Y) (= Y Z)); same for < > <= >= lisp/ChangeLog addition: 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): When these functions are handed more than two arguments, and those arguments have no side effects, transform to a series of two argument calls, avoiding funcall in the byte-compiled code. * mule/mule-cmds.el (finish-set-language-environment): Take advantage of this change in a function called 256 times at startup.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 16 Sep 2010 14:31:40 +0100
parents 0d436a78c514
children 90a0084b3541
comparison
equal deleted inserted replaced
5265:5663ae9a8989 5266:f9ec07abdbf9
3771 (vector (cons 'vconcat (cddr form))) 3771 (vector (cons 'vconcat (cddr form)))
3772 (bit-vector (cons 'bvconcat (cddr form))) 3772 (bit-vector (cons 'bvconcat (cddr form)))
3773 (string (cons 'concat (cddr form)))) 3773 (string (cons 'concat (cddr form))))
3774 form)) 3774 form))
3775 3775
3776 (map nil
3777 #'(lambda (function)
3778 ;; There are byte codes for the two-argument versions of these
3779 ;; functions; if the form has more arguments and those arguments
3780 ;; have no side effects, transform to a series of two-argument
3781 ;; calls.
3782 (put function 'cl-compiler-macro
3783 #'(lambda (form &rest arguments)
3784 (if (or (null (nthcdr 3 form))
3785 (notevery #'cl-safe-expr-p (cdr form)))
3786 form
3787 (cons 'and (mapcon
3788 #'(lambda (rest)
3789 (and (cdr rest)
3790 `((,(car form) ,(pop rest)
3791 ,(car rest)))))
3792 (cdr form)))))))
3793 '(= < > <= >=))
3794
3776 (mapc 3795 (mapc
3777 #'(lambda (y) 3796 #'(lambda (y)
3778 (put (car y) 'side-effect-free t) 3797 (put (car y) 'side-effect-free t)
3779 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro) 3798 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro)
3780 (put (car y) 'cl-compiler-macro 3799 (put (car y) 'cl-compiler-macro