[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimizer? What optimizer?
From: |
Daniel Colascione |
Subject: |
Re: Optimizer? What optimizer? |
Date: |
Mon, 06 Jun 2011 19:36:40 -0700 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
On 6/6/11 7:33 PM, Daniel Colascione wrote:
> Is there some fundamental reason defsubst does so poorly here compared
> to defmacro?
>
> ---
> [snip stupidity]
What I meant was this:
(defmacro foo-macro (a b)
`(if ,a
,b
(1+ ,b)))
(defun bar-macro (b)
(foo-macro t b))
(defun qux-macro (b)
(foo-macro nil b))
;; byte code for bar-macro:
;; args: (b)
;; 0 varref b
;; 1 return
;;
;; byte code for qux-macro:
;; args: (b)
;; 0 varref b
;; 1 add1
;; 2 return
;;
(defsubst foo-subst (a b)
(if a
b
(1+ b)))
(defun bar-subst (b)
(foo-subst t b))
(defun qux-subst (b)
(foo-subst nil b))
;; byte code for bar-subst:
;; args: (b)
;; 0 constant t
;; 1 varref b
;; 2 varbind b
;; 3 dup
;; 4 varbind a
;; 5 goto-if-nil 1
;; 8 varref b
;; 9 goto 2
;; 12:1 varref b
;; 13 add1
;; 14:2 unbind 2
;; 15 return
;;
;; byte code for qux-subst:
;; args: (b)
;; 0 constant nil
;; 1 varref b
;; 2 varbind b
;; 3 dup
;; 4 varbind a
;; 5 goto-if-nil 1
;; 8 varref b
;; 9 goto 2
;; 12:1 varref b
;; 13 add1
;; 14:2 unbind 2
;; 15 return
;;
signature.asc
Description: OpenPGP digital signature