[m-dev.] TinyCC - May be worth investigating

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Feb 1 02:25:13 AEDT 2003

On 31-Jan-2003, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> I don't know whether this is of any interest to the back-end hackers:
> http://fabrice.bellard.free.fr/tcc/
> It's certainly a fast compiler
> http://mail.gnu.org/archive/html/tinycc-devel/2002-11/msg00025.html
> even if the binaries it produces aren't going to break any speed
> records (and it doesn't seem as though the C compiler adds much to
> Mercury compile times anyway.)

I have installed tcc 0.9.14 on earth.cs.mu.oz.au, and tried using it
with Mercury.  Unfortunately it doesn't work with the C code that the
Mercury compiler generates for most Mercury modules, due to a bug in tcc.
I have reported the bug.

I did get some timing data, but only on a very small file:
samples/sort.m (120 lines).

host	step		  compiler				time (s)
----    ----              --------                              -------
earth	Mercury->C	  mmc --grade hlc.gc -O2		0.38
earth	Mercury->C	  mmc --grade hlc.gc -O0		0.36

earth	C->object	  gcc -O2				0.38
earth	C->object	  gcc -O1				0.36
earth	C->object	  gcc -O0				0.34
earth	C->object	  lcc    				0.21
earth	C->object	  tcc    				0.13

earth	Mercury->object	  mcc -O2 & gcc -O2			0.77
earth	Mercury->object	  mcc -O2 & gcc -O1   			0.75
earth	Mercury->object	  mcc -O2 & gcc -O0   			0.73
earth	Mercury->object	  mcc -O2 & lcc    			0.58
earth	Mercury->object	  mcc -O2 & tcc    			0.50

earth	Mercury->object	  mcc -O0 & gcc -O2			0.74
earth	Mercury->object	  mcc -O0 & lcc    			0.55
earth	Mercury->object	  mcc -O0 & tcc    			0.48

So using tcc it takes a total of .48 seconds, as compared with .58 for
lcc and .74 for gcc.  That's a 54% speedup, as opposed to only a 34%
speedup with lcc.

This is about the same as the speedup produced by `--target asm',
or perhaps a little less.  I wasn't able to compare `--target asm'
with tcc directly, but on hg, `lcc' gives a speedup of 39%, and
`--target asm' produces a speedup of 59% compared with gcc.

host	step		  compiler				time (s)
----    ----              --------                              -------
hg	Mercury->object	  mcc -O2 & gcc -O2    			1.64
hg	Mercury->object	  mcc -O2 & lcc    			1.18
hg	Mercury->object	  mmc -O2 --target asm			1.03

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list