More on Green Hills C

Jim Franklin jwf at vaxine.UUCP
Tue Dec 20 08:13:51 AEST 1983


In a previous note I asked if anyone knew about Green Hills Software of
Pasadena, CA and their optimizing C compiler for the Motorola 68000.  Since
that time we have received additional info from Green Hills (GH) and have some
benchmark results for their compiler, both with and without their optimizer
turned on.

Without the optimizer, the GH compiler generated code almost twice as fast and
half the size of the code generated by our PASCAL compiler.  With the
optimizer turned on (i.e., -O switch) the performance of the compiler was
more dependent on the benchmark.  For the first benchmark (which was mostly
nested "for" loops and array references) the optimized code was close to
hand-coded assembler, and executed 3 times as fast as the code generated by
our PASCAL compiler.  On the remaining three benchmarks the optimizer produced
code about twice as fast as our PASCAL code, but only 5 to 15 percent faster
than the "unoptimized" GH code.

The rest of this note describes the benchmark results and some of the
compilers we tested.  Our PASCAL compiler was originally purchased from
Renaissance Software (now merged with TeleSoft).  We have made improvements to
the code generation routines for such things as the WITH statement and access
to globally defined symbols.  The MIT C compiler is a C compiler we received
from Massachusetts Institute of Technology -- many of the existing C compilers
for the 68000 are descendants of this compiler.

The benchmark programs performed the following tasks:

+  Test 1 did a bubble sort on 1024 numbers.  The numbers were in reverse
   sort order, so the test required n*(n-1)/2 comparisons (about half a
   million).  Size:  24 lines of PASCAL.

+  Test 2 computed (many times) all prime numbers between 1 and 8000.
   Size: 31 lines of PASCAL.

+  Test 3 manipulated a doubly-linked list and used a large CASE (switch)
   statement.  Size: 66 lines of PASCAL.

+  Test 4 was a collection of symbol table management routines for a
   high-level language interpreter.  It performed hashing, manipulated
   linked lists, and did various sorting operations.  Size: 432 lines of
   PASCAL.

Each program was implemented in C and PASCAL using the same underlying
algorithm.  Language specific optimizations were used (such as register in C,
WITH in PASCAL).  The programs were then executed on one of our 68000-based
systems.  The code sizes and execution times are shown in the table below:

+------+---------------------------------+-----------------------------------+
|      |    CODE SIZE (BYTES,DECIMAL)    |      EXECUTION TIME (SECONDS)     |
|      +-------+-------+--------+--------+--------+--------+--------+--------+
| TEST |   P   | MIT C |  GH C  | GH C/O |   P    | MIT C  |  GH C  | GH C/O |
+------+-------+-------+--------+--------+--------+--------+--------+--------+
|      |       |       |        |        |        |        |        |        |
|  1   |  220  |  184  |  134   |  102   |  24.4  |  24.4  |  17.4  |   8.1  |
|      |       |       |        |        |        |        |        |        |
|  2   |  224  |  172  |  104   |  140   |  11.7  |   9.1  |   7.0  |   6.1  |
|      |       |       |        |        |        |        |        |        |
|  3   |  368  |  288  |  258   |  258   |  13.3  |  11.1  |   9.7  |   8.7  |
|      |       |       |        |        |        |        |        |        |
|  4   |  2082 | 2052  |  1332  |  1390  |  25.7  |  17.5  |  12.9  |  12.3  |
|      |       |       |        |        |        |        |        |        |
+------+-------+-------+--------+--------+--------+--------+--------+--------+

 P = PASCAL                     MIT C = MIT C with optimizer (-O)
 GH C = Green Hills C           GH C/O = Green Hills C with optimizer (-O)

If anyone knows about any other optimizing compilers for the 68000, please
send me a note via mail.



More information about the Comp.lang.c mailing list