[gambit-list] Using TCC
fred.weigel at zylog.ca
Fri Feb 8 15:50:38 EST 2013
I generally hack on a netbook, which has a very slow hard drive (but is
1.66 GHz, 1 GB memory). So, gsc using gcc is a bit slow sometimes. I
decided to try tcc (Gambit-C 4.6.6 - 64 bit - Fedora 17, tcc 0.9.25 -
built from current web distribution).
0.9.25 supports 64 bit x86 code.
I did not rebuild gsi or gsc with tcc, but simply incorporated tcc into
the gambc-cc script.
With 13,156 lines of Scheme (my "standard library")
Building with tcc:
4,465,784 bytes of object code.
Building with gcc (4.7.2):
With 4,004,348 bytes of object obtained.
Now, I haven't tested the results extensively at all, but I am very
happy so far (no obvious problems).
The change made to gambc-cc is an insertion at line 13 (just above
DEFS_OBJ=...). I added the following hack:
==> Cut <==
# If CC is tcc, use that instead. We use tcc 0.9.25
# Most of the options are meaningless with this compiler, but we grab
# the ones that do make sense. Gambit-C itself has not been built with
# tcc (I use the Fedora repo version of 4.6.6), but code that is
# generated by gsc is compiled with tcc. So far, no problems! (larger
# code size by up to 40% for "Hello world", but MUCH faster compilation
# of C files).
if [ "$CC" == "tcc" ]; then
FLAGS_DYN="-g -Wall -rdynamic -shared"
FLAGS_LIB="-g -Wall -rdynamic -shared"
FLAGS_EXE="-g -Wall -rdynamic"
==> Cut <==
To use, simply define CC=tcc in your enviroment (export CC=tcc), or put
a similar statement into the Makefile (presuming that is used).
I have not measured execution speed of Scheme code at all, but a 6x
improvement in compilation speed is worth continuing along this path
(for me, anyway). Typically, object size increases by 10% (for my
standard library) to 40% (for a simple "hello world" example).
I won't be able to expend cycles benchmarking code with tcc -- I am
more interested in any failure cases from this compiler. Maybe
someone can do a benchmark run?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gambit-list