next up previous contents
Next: 5.13 Efficiency Notes Up: 5.12 General Efficiency Hints Previous: 5.12.4 Mapping and Iteration

5.12.5 Trace Files and Disassembly

             

In order to write efficient code, you need to know the relative costs of different operations. The main reason why writing efficient Common Lisp code is difficult is that there are so many operations, and the costs of these operations vary in obscure context-dependent ways. Although efficiency notes point out some problem areas, the only way to ensure generation of the best code is to look at the assembly code output.

The disassemble function is a convenient way to get the assembly code for a function, but it can be very difficult to interpret, since the correspondence with the original source code is weak. A better (but more awkward) option is to use the :trace-file argument to compile-file to generate a trace file.

A trace file is a dump of the compiler's internal representations, including annotated assembly code. Each component in the program gets four pages in the trace file (separated by ``tex2html_wrap_inline16069''):

Note that trace file generation takes much space and time, since the trace file is tens of times larger than the source file. To avoid huge confusing trace files and much wasted time, it is best to separate the critical program portion into its own file and then generate the trace file from this small file.


next up previous contents
Next: 5.13 Efficiency Notes Up: 5.12 General Efficiency Hints Previous: 5.12.4 Mapping and Iteration

Raymond Toy
Mon Jul 14 09:11:27 EDT 1997