Next: , Previous: , Up: Advanced Compiler Use and Efficiency Hints   [Contents][Index]


5.11 Numbers

Numbers are interesting because numbers are one of the few Common Lisp data types that have direct support in conventional hardware. If a number can be represented in the way that the hardware expects it, then there is a big efficiency advantage.

Using hardware representations is problematical in Common Lisp due to dynamic typing (where the type of a value may be unknown at compile time.) It is possible to compile code for statically typed portions of a Common Lisp program with efficiency comparable to that obtained in statically typed languages such as C, but not all Common Lisp implementations succeed. There are two main barriers to efficient numerical code in Common Lisp:

Because of its type inference (see type-inference) and efficiency notes (see efficiency-notes), Python is better than conventional Common Lisp compilers at ensuring that numerical expressions are statically typed. Python also goes somewhat farther than existing compilers in the area of allowing native machine number representations in the presence of garbage collection.


Next: General Efficiency Hints, Previous: Object Representation, Up: Advanced Compiler Use and Efficiency Hints   [Contents][Index]