next up previous contents
Next: 5.11.1 Descriptors Up: 5 Advanced Compiler Use Previous: 5.10.6 Hashtables

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 section 5.3) and efficiency notes (see section 5.13), 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.





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