Re: Byte compiler inefficiency

2005-08-09 Thread Stefan Monnier
> (defsubst cadr (x) > "Return the car of the cdr of X." > (car (cdr x))) There has already been discussions of such issues on this list. There are various ways to make byte-opt.el get rid of the extra varbind. I had a suggestion, but it's not robust against some improperly nested byte-code (

Re: Byte compiler inefficiency

2005-08-09 Thread David Kastrup
"Richard M. Stallman" <[EMAIL PROTECTED]> writes: > > When cadr is called interpretively, the binding of x is like > > any other binding. > > Sure, but the binding can't possible have any effect on the > result. > > In the particular case of cadr, it can't, because no non-primitive

Re: Byte compiler inefficiency

2005-08-08 Thread Richard M. Stallman
> When cadr is called interpretively, the binding of x is like any > other binding. Sure, but the binding can't possible have any effect on the result. In the particular case of cadr, it can't, because no non-primitive functions are called. If the compiler could detect this kind of c

Re: Byte compiler inefficiency

2005-08-08 Thread Richard M. Stallman
The binding for x is completely unnecessary and wasteful. It is necessary in order for compiled code to do the same thing as the interpreted code. When cadr is called interpretively, the binding of x is like any other binding. Now, we could consider adopting the convention that it is ok for

Re: Byte compiler inefficiency

2005-08-08 Thread David Kastrup
"Richard M. Stallman" <[EMAIL PROTECTED]> writes: > The binding for x is completely unnecessary and wasteful. > > It is necessary in order for compiled code to do the same thing as > the interpreted code. No, unless by "same thing" you mean "equally inefficient" in which case defsubst would n

Byte compiler inefficiency

2005-08-07 Thread David Kastrup
Hi, we have (defsubst cadr (x) "Return the car of the cdr of X." (car (cdr x))) And if we use that, for example, in (defun woozle (blurb) (cadr blurb)) then the byte compiler delivers the result: byte code for woozle: args: (blurb) 0 varrefblurb 1 dup 2 varb