Performance Evaluation

Quantitative criteria for compiler quality are the size and the execution time of the generated code and the time a compiler needs to translate a given program. The smaller the number, the better the compiler. Other criteria such as the 'quality' of the generated code are hard to measure. Elaborate test program suites are available for languages like for FORTRAN or C but not for Oberon. We had to make do with well known, small, computationally intensive algorithms such as Knights Tour, Primes, etc.

We implemented the test programs in Pascal first and ported them to C and Oberon, preserving the structure as good as we could. The compilers tested were MPW Pascal, MPW C, MPW Oberon, and MacOberon. MPW Pascal and MPW C are commercial products. The latter two work with intermediate code and supposedly employ elaborate optimizations to reduce code size and execution speed. We measured on a Macintosh Quadra 700 equipped with a 25 MHz MC 68040 and 8 MBytes of RAM. Table 1 shows the time consumed averaged over five executions of the respective programs.

MPW Oberon generates the fastest code on average. The fact that MPW Oberon is even faster than MPW C came as a genuine surprise, after all MPW C is a sophisticated optimizing compiler in its third version. MacOberon, the second Oberon compiler in our test series, produces equally good code as the C compiler, proving that a good programming language can be as efficient as C (against popular belief!). Analysis of the object code revealed that C wins in the first three categories because it uses register variables. The two Oberon compilers are not taking advantage of register variables.

MPW PascalMPW CMPW OberonMacOberon
Powers375246411788
Heuristic2089176517951854
Primes9145761003991
Integrate4952544239644087
KnightsTour7826470542484867
Marriage1714207519702157
Selection2313481355421
Bubble3809275924573889
Hanoi2584419322012160
Quicksort2998209223572598
Queens5489804653804743
IMatMult249290181222
RMatMult266312183226
Rating39342334
Table 1: Execution times in milliseconds. Best values bold.
In table 2 MPW Oberon wins again, now in the time it needs to translate the sample programs. We believe that our compiler treats the import of modules in a more efficient fashion than the other compilers, for example with a better data structure for identifiers (see above). The effect of differences in import module treatment are somewhat out of proportion since the examples are very short.

MPW PascalMPW CMPW OberonMacOberon
Powers9921614102590
Heuristic10421800218633
Primes14061484168636
Integrate10181340212640
KnightsTour10441998214647
Marriage15562160188660
Selection10221236210586
Bubble14221400162529
Hanoi9381432170653
Quicksort14921682198553
Queens10882234202569
IMatMult12101704200660
RMatMult12161456180633
Rating40511326
Table 2: Compilation time in milliseconds. Best values bold.
Finally table 3 lists the size of the generated object code. C takes this category with a wide margin for two reasons:

MPW PascalMPW CMPW OberonMacOberon
Powers392288434528
Heuristic412402470538
Primes322246374424
Integrate898744722802
KnightsTour583394614704
Marriage108673015942176
Selection544370562718
Bubble326290244384
Hanoi152148132180
Quicksort344280318458
Queens452424474572
IMatMult572452476598
RMatMult604488504626
Rating33163051
Table 3: Object code size in bytes. Best values bold

Previous Section, Next Section, Contents