[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Don't use => in COND...
Date: Tue, 16 Jul 85 12:14:27 EDT
From: Ashwin Ram <Ram at YALE.ARPA>
... It is very inefficient (wrt both time and cells) to
use this construct, especially in interpreted code.
If you have any evidence that TC is generating object code from =>
clauses that is worse than that generated from equivalent source code
not using =>, please let me know. I don't believe that it does.
Interpreted code is inefficient anyhow. Rewriting your code is only one
way to get an improvement there. It would be very easy to modify the
interpreter to speed up this special case. Look at the source for
EVAL.T and figure out how to write interpreters for special forms
currently implemented as macros. (Yes, T DOES have fexprs!) While
you're at it, fix LET, OR, PUSH, WITH-OUTPUT-TO-STREAMS, OBJECT, etc.,
all of which suffer from closure-consing problems. If you have
questions about how to do this, I'd be happy to answer them. I guess
that when I wrote STANDARD-COMPILER I was not overly concerned with
things like this.
Other alternatives: redefine the COND macro (etc.) to do smarter things
(this, in effect, is how many Lisp systems work: each macro definition
contains its own little compiler and source-code analysis tools, and has
its own semantic peculiarities and bugs); or, write a preprocessor which
converts your source code to a more efficient form, doing variable
substitution etc. (i.e. the same things that TC does).