[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: computational efficiency lisping
- To: mmeehan@eesof.com (Mike Meehan)
- Subject: Re: computational efficiency lisping
- From: Michael Travers <mt@media.mit.edu>
- Date: Wed, 27 May 92 17:37:29 -0400
- Cc: info-mcl@cambridge.apple.com
- Full-name:
- In-reply-to: Your message of "Tue, 26 May 92 15:15:24 PDT." <9205262215.AA01988@sauron>
The MCL compiler does pay attention to declarations and will put many
operations in-line if it can. I've enclosed some macros for doing
fast integer arithmetic that I use (derived from Boxer).
Similar macros can speed up other operations. Car, cdr, and svref
will compile in-line, but aref will not, as far as I can tell. Nor
will integer multiply. Perhaps the implementors can give more
authoritative advice.
(defmacro def-arith-op (int-name reg-name)
`(defmacro ,int-name (&rest args)
`(the fixnum (,',reg-name ,@(mapcar #'(lambda (arg) `(the fixnum ,arg)) args)))))
(def-arith-op +& +) ; Only addition-type ops actually get any boost in MCL2.0
(def-arith-op -& -)
(def-arith-op incf& incf)
(def-arith-op decf& decf)
(def-arith-op 1+& 1+)
(def-arith-op 1-& 1-)
Using &+ will compile an inline integer add instead of a subroutine
call.