5.1.1 Interpreted and Compiled Code

Every serious computer algebra system, e.g., MAGMA, PARI, Mathematica, Maple, GAP, Singular, etc., is implemented as a combination of compiled and interpreted code. For Mathematica, Singular, MAGMA, and PARI, most of the implementation is in compiled C (or C++) code; some of these systems tend to be very optimized (subject to the constraints of the algorithms they implement). In contrast, Maple and GAP have a relatively small compiled ``kernel'' that defines the underlying programming language; most of the system is then implemented in this language. If you do benchmarks you'll discover that Mathematica is much faster than Maple at some basic operations. Likewise, benchmarks reveal that MAGMA is often faster than GAP.

This fusion of interpreted and compiled code is extremely natural for mathematics software; some algorithms are much better implemented in an interpreter because all time-critical steps involve low level arithmetic -- other algorithms, e.g., matrix multiplication, must be implemented in a compiled language in order to perform optimally. Also, existing compiled libraries are sometimes of very high quality, and a compiled language is needed to create the best possible interface to such libraries. It's crucial that both approaches to programming be fully supported. When deciding how to implement Sage, I searched for months for an environment that could support both approaches. Python and Cython provide exactly this in a way that I believe is much easier conceptually than the implementation models of any of the other systems mentioned above.

See About this document... for information on suggesting changes.