[gambit-list] Using TCC

Fred Weigel fred.weigel at zylog.ca
Tue Feb 12 23:43:16 EST 2013


Marc

All right. First TCC results:

gsi - appears to work...
gsc - doesn't work (spins somewhere, very busy)

First two tests pass (tests/ directory), third test "hangs" (at least,
takes longer than 10 minutes).

I guess I need a baseline.

HOWEVER - I can benchmark the system with the old compiler using tcc
(why not, code generation should be the same).

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 at 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://bellard.org/tcc/
> > 
> > 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 at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
> 



More information about the Gambit-list mailing list