[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
optimizing code using declarations
- To: info-macl@cambridge.apple.com, rjz@chaos.cs.brandeis.edu
- Subject: optimizing code using declarations
- From: "Roland Zito-Wolf" <rjz@chaos.cs.brandeis.edu>
- Date: Mon, 15 Jun 92 12:19:18 -0400
I am trying to speed up a loop in a critical section. The loop does
nothing but integer math, array and structure references, and
calls to bit-and and bit-or. My question is:
1. Given how liberal the Commonlisp spec is about what declarations
can and cant be ignored; and
2. Given how hard it is to tell when one has managed to declare every
instance/reference to a given variable/function (eg, which declaration scoping
rule does macl 1.3 and 2.0 use? do i need to put (the X) formas around
all intermediate results? Do i have to declare built-in functions? ); and
3. Given that (to my knowledge) the compiler gives no messages about what has
or has not been optimized and/or coded inline, or any compilation statistics such
as size of the resulting code, subprimitive calls, etc,
or as to which decls have been ignored or utilized; and
4. Given that, in all fairness to MACL, optimizing LISP code is in general
a fairly intricate and painful process:
Then: how does one go about
optimizing a piece of code other than iterating thorgh hundreds of trials of
(loop while (not (exasperated-p))
do (tweak-declarations)
do (compile)
do (disassemble-and-guess-what-code-is-doing))?
thanks,
rjz
(PS: anything along the line of #3 would i think be of great general utility.)
(PPS: How useful is it to move oft-referenced quantities into local variables,
and if so, how many such efficient local variables can one have?)