Gcc, Lcc, and 2c

Michael John Haertel <mike@skinner.cs.uoregon.edu>
Thu, 7 Jan 1993 01:30:46 GMT

          From comp.compilers

Related articles
Code quality drw@zermelo.mit.edu (1993-01-06)
Re: Code quality davidm@questor.rational.com (1993-01-06)
Gcc, Lcc, and 2c mike@skinner.cs.uoregon.edu (Michael John Haertel) (1993-01-07)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Michael John Haertel <mike@skinner.cs.uoregon.edu>
Organization: Compilers Central
Date: Thu, 7 Jan 1993 01:30:46 GMT
Keywords: optimize
References: 93-01-020 93-01-017

The moderator wrote:

>[It varies all over the place. The Princeton/Bell Labs lcc compiler
>is supposed to produce better code faster than GCC. Ken Thompson's Plan 9
>compiler is supposed to be better still in both dimensions. -John]

This isn't true. My experience was that Gcc produces faster code than
Lcc. Methodology: Compile both compilers with themselves and each other.
Time the amount of time both compilers take. I found that the
lcc-compiled compilers typically ran 5-10% slower than the gcc-compiled
compilers. I suspect that any published comparisons that show Lcc
producing faster code are either based on not using -O with gcc, or or
used a poorly tuned port of gcc.

I was not able to compare 2c directly with gcc, since gcc had not been
ported to Plan 9, but again I suspect Gcc-compiled code is as good or
faster. Despite claims to the contrary in Thompson's paper. My guess is
that either (a) he didn't use -O with gcc, or (b) he ran his comparisons
on the MIPS. The MIPS version of gcc in 1990 was very poorly tuned. (On
the 680x0, also add (c) use of 16-bit addressing modes that Gcc can't use
for lack of linker magic.)

There is no question, though, that both Lcc and 2c themselves run much
faster than gcc. Lcc is at least twice as fast, and 2c is probably faster
still. The Bell Labs folks seem to care more about compile time than
extreme optimization of the generated code. This is quite reasonable
considering how much of their time they spend compiling.

Unfortunately, I have no hard data to offer and I no longer have access to
Lcc or 2c. It would be nice if a disinterested third party with access to
all three compilers would do a comparison...

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.