Marc
I brought down gambc-v4_6_6-devel
./configure CC=tcc --enable-single-host
I then did
time make
make[1]: Leaving directory `/export/home/fred/Downloads/gambc-v4_6_6-devel/prebuilt'
real 0m31.620s user 0m28.775s sys 0m2.241s
(On my 1.66 GHz Atom, single core, with 1 GB RAM). Build seems successful, running through testing. I did upgrade tcc to the git "mob" head, because I found an issue with the older tcc (64 bit structure copies were sometimes, um.., mis-sized, seems ok with the most recent version).
Fred Weigel
On Tue, 2013-02-12 at 13:09 -0500, Marc Feeley wrote:
Very cool! I have been a fan of TCC for a long time and have been interested in combining TCC and Gambit to make a standalone distribution of Gambit. I'm glad to see that TCC can compile Gambit generated code. Could you try building Gambit using TCC? I wonder how fast TCC generated code is.
Marc
On 2013-02-08, at 3:50 PM, Fred Weigel fred.weigel@zylog.ca wrote:
All:
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).
http://download.savannah.nongnu.org/releases/tinycc/tcc-0.9.25.tar.bz2
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.
Results:
With 13,156 lines of Scheme (my "standard library")
Building with tcc:
real 0m25.577s user 0m18.633s sys 0m3.290s
4,465,784 bytes of object code.
Building with gcc (4.7.2):
real 3m47.997s user 3m8.047s sys 0m11.283s
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 C_COMPILER="tcc" FLAGS_OBJ="-g -Wall" FLAGS_DYN="-g -Wall -rdynamic -shared" FLAGS_LIB="-g -Wall -rdynamic -shared" FLAGS_EXE="-g -Wall -rdynamic" fi ==> 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?
Fred Weigel
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list