* [gentoo-dev] gcc vs tcc
@ 2002-11-29 17:41 Per Wigren
2002-11-29 18:43 ` Karl Trygve Kalleberg
2002-11-29 19:27 ` Sven Vermeulen
0 siblings, 2 replies; 10+ messages in thread
From: Per Wigren @ 2002-11-29 17:41 UTC (permalink / raw
To: gentoo-dev
Is it OK to add dev-lang/tcc as a build-dependancy?
Compiling GOBO (http://www.gobosoft.com) with gcc 3.2.1 takes about 3 hours on
my dual athlon 1.2Ghz with 512mb RAM...
Compare this:
oggy gexace # time gcc -O2 -o gexace-gcc gexace.c
real 10m12.746s
user 9m33.227s
sys 0m4.897s
oggy gexace # time tcc -o gexace-tcc gexace.c
real 0m1.353s
user 0m0.472s
sys 0m0.061s
oggy gexace # ls -l gexace-*
-rwxr-xr-x 1 root root 1216938 Nov 29 18:27 gexace-gcc
-rwxr-xr-x 1 root root 994200 Nov 29 18:27 gexace-tcc
It's almost silly! :) I've done some just-for-fun benchmarking and found that
tcc generates code about as fast as "gcc -O2", but is a little bit slower
than "-O3" and even more so when adding things like "-fomit-frame-pointer"
and "-ffast-math"... But the gobo-utilities are more I/O-intensive than
CPU-intensive so it shouldn't matter much..
gexace is one of several huge (2mb+) .c-files that is part of gobo (generated
by the eiffel-compiler).. Using tcc, compiling it will take about one minute
while it takes 3 hours with gcc...
Regards,
Per Wigren
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 17:41 [gentoo-dev] gcc vs tcc Per Wigren
@ 2002-11-29 18:43 ` Karl Trygve Kalleberg
2002-11-29 19:22 ` Per Wigren
2002-11-29 19:27 ` Sven Vermeulen
1 sibling, 1 reply; 10+ messages in thread
From: Karl Trygve Kalleberg @ 2002-11-29 18:43 UTC (permalink / raw
To: gentoo-dev
On Fri, 29 Nov 2002 18:41:12 +0100
Per Wigren <wigren@home.se> wrote:
> Is it OK to add dev-lang/tcc as a build-dependancy?
This makes for a _VERY_ interesting case. I think we should toy with this
concept a bit, as we can save ~3hrs compilation time (provided your
results are good, which I have all reason to think) and it's on a
non-critical package.
I suggest:
1) Only use tcc on platforms you have tested it on, so check ARCH and have
a
x86? dev-lang/tcc-<version> in your DEPEND.
2) Only leave tcc in the DEPEND= and specifically exclude it in RDEPEND
(the assumption I make is that a tcc-compiled binary doesn't depend on a
tcc runtime); all too often, build-time tools end up in RDEPEND, which is
completely and utterly wrong.
3) Depending on how many packages can benefit from tcc, we may want to
introduce a useflag for it. May, as it increases the total maintenance
cost of the tree.
Have you done any tests to see how many of the "regular" packages compile
nicely with tcc ? Can we compile XFree with it ? (Obviously mozilla is not
a candidate, as it's largely written in C++).
Kind regards,
Karl T
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 18:43 ` Karl Trygve Kalleberg
@ 2002-11-29 19:22 ` Per Wigren
2002-11-29 19:43 ` George Shapovalov
0 siblings, 1 reply; 10+ messages in thread
From: Per Wigren @ 2002-11-29 19:22 UTC (permalink / raw
To: Karl Trygve Kalleberg, gentoo-dev
Friday 29 November 2002 19:43 skrev Karl Trygve Kalleberg:
> On Fri, 29 Nov 2002 18:41:12 +0100
>
> Per Wigren <wigren@home.se> wrote:
> > Is it OK to add dev-lang/tcc as a build-dependancy?
>
> This makes for a _VERY_ interesting case. I think we should toy with this
> concept a bit, as we can save ~3hrs compilation time (provided your
> results are good, which I have all reason to think) and it's on a
> non-critical package.
>
> I suggest:
> 1) Only use tcc on platforms you have tested it on, so check ARCH and have
> a x86? dev-lang/tcc-<version> in your DEPEND.
I only tested with a manual build of tcc-0.9.14.. The latest in portage is
0.9.7 which is very outdated and 0.9.14 needs adding a #define in a file to
make it compile on gcc 3.x so I think we should wait for 0.9.15 because that
is already fixed in cvs so there will be no need for sed-hacking then...
> 2) Only leave tcc in the DEPEND= and specifically exclude it in RDEPEND
> (the assumption I make is that a tcc-compiled binary doesn't depend on a
> tcc runtime); all too often, build-time tools end up in RDEPEND, which is
> completely and utterly wrong.
I know, I always do that. I'm also annoyed with people not separating
DEPEND/RDEPEND...
> 3) Depending on how many packages can benefit from tcc, we may want to
> introduce a useflag for it. May, as it increases the total maintenance
> cost of the tree.
We should only try do it for packages that takes more than 10-15 minutes to
compile on a fairly fast machine...
> Have you done any tests to see how many of the "regular" packages compile
> nicely with tcc ? Can we compile XFree with it ? (Obviously mozilla is not
> a candidate, as it's largely written in C++).
I don't know about XFree, but I don't think there should be a problem.. TCC
supports 100% of ANSI-C, 90% of C99-specific things and the most common
GCC-extensions.. I read somewhere that they pass all test but 10 or so in
GCC's testsuite (which has THOUSANDS of tests!)..
>
>
> Kind regards,
>
> Karl T
>
> --
> gentoo-dev@gentoo.org mailing list
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 17:41 [gentoo-dev] gcc vs tcc Per Wigren
2002-11-29 18:43 ` Karl Trygve Kalleberg
@ 2002-11-29 19:27 ` Sven Vermeulen
2002-11-29 20:39 ` Per Wigren
1 sibling, 1 reply; 10+ messages in thread
From: Sven Vermeulen @ 2002-11-29 19:27 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 640 bytes --]
On Fri, Nov 29, 2002 at 06:41:12PM +0100, Per Wigren wrote:
> Is it OK to add dev-lang/tcc as a build-dependancy?
> Compiling GOBO (http://www.gobosoft.com) with gcc 3.2.1 takes about 3
> hours on
> my dual athlon 1.2Ghz with 512mb RAM...
>
> Compare this:
>
> oggy gexace # time gcc -O2 -o gexace-gcc gexace.c
> real 10m12.746s
> user 9m33.227s
> sys 0m4.897s
> oggy gexace # time tcc -o gexace-tcc gexace.c
> real 0m1.353s
> user 0m0.472s
> sys 0m0.061s
Are you certain this is correct ? You did remove the created object-files (or
did a "make clean") before retrying with tcc, did you ?
Wkr,
Sven Vermeulen
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 19:22 ` Per Wigren
@ 2002-11-29 19:43 ` George Shapovalov
2002-11-29 23:22 ` Per Wigren
0 siblings, 1 reply; 10+ messages in thread
From: George Shapovalov @ 2002-11-29 19:43 UTC (permalink / raw
To: gentoo-dev
Hi guys.
Yes this would make for a very interesting investigation ;).
Just a small opinion here:
On Friday 29 November 2002 11:22, Per Wigren wrote:
> Friday 29 November 2002 19:43 skrev Karl Trygve Kalleberg:
> > On Fri, 29 Nov 2002 18:41:12 +0100
[skipped]
> I don't know about XFree, but I don't think there should be a problem.. TCC
> supports 100% of ANSI-C, 90% of C99-specific things and the most common
> GCC-extensions.. I read somewhere that they pass all test but 10 or so in
> GCC's testsuite (which has THOUSANDS of tests!)..
So this does have a potential for breakage in various packages. Even if it
were 100% gcc compatible we shouldn't trust it without doing a really
extensive testing. Besides many people will choose to have a "more coherent"
system based solely on gcc and will be glad to pay the price in compile time.
Therefore I think use of tcc should be made optional (even opt-in in the
beginning if you ask me). New use flag suits this very well and I think is
completely warranted (and for the same reason I do not like putting this into
DEPEND).
George
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 19:27 ` Sven Vermeulen
@ 2002-11-29 20:39 ` Per Wigren
0 siblings, 0 replies; 10+ messages in thread
From: Per Wigren @ 2002-11-29 20:39 UTC (permalink / raw
To: Sven Vermeulen; +Cc: gentoo-dev
Friday 29 November 2002 20:27 skrev Sven Vermeulen:
> On Fri, Nov 29, 2002 at 06:41:12PM +0100, Per Wigren wrote:
> > Is it OK to add dev-lang/tcc as a build-dependancy?
> > Compiling GOBO (http://www.gobosoft.com) with gcc 3.2.1 takes about 3
> > hours on
> > my dual athlon 1.2Ghz with 512mb RAM...
> >
> > Compare this:
> >
> > oggy gexace # time gcc -O2 -o gexace-gcc gexace.c
> > real 10m12.746s
> > user 9m33.227s
> > sys 0m4.897s
> > oggy gexace # time tcc -o gexace-tcc gexace.c
> > real 0m1.353s
> > user 0m0.472s
> > sys 0m0.061s
>
> Are you certain this is correct ? You did remove the created object-files
> (or did a "make clean") before retrying with tcc, did you ?
>
> Wkr,
> Sven Vermeulen
Yes it is correct! Believe it or not!
This is the result for wv after commenting away some stuff that tcc didn't
want to compile, withouth caring if the result would work or not (tcc is MUCH
stricter ANSI-C than GCC and this is just a compiletime-benchmark;)) :
# make distclean
# time X=$(export CC=gcc ; ./configure ; make)
real 1m45.230s
user 1m33.243s
sys 0m6.521s
# make distclean
# time X=$(export CC=tcc ; ./configure ; make)
real 0m9.065s
user 0m5.873s
sys 0m2.925s
# make distclean
# export CC=gcc
# ./configure
# time make >/dev/null
real 1m41.574s
user 1m30.151s
sys 0m4.611s
# make distclean
# export CC=tcc
# ./configure
# time make >/dev/null
real 0m6.369s
user 0m4.578s
sys 0m1.450s
Still not convinced? :)
Here is the gexace.c-file I used as an example earlier.. Try it yourself!
http://www.wigren.nu/gexace.c.bz2
Get the latest tcc from http://www.tinycc.org! You'll need to add
#define RTLD_DEFAULT NULL
to the beginning of tccelf.c before compiling it with gcc 3.2.x!
BTW, notice the total size of the tcc archive.. 150K! :D
Regards,
Per Wigren
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 19:43 ` George Shapovalov
@ 2002-11-29 23:22 ` Per Wigren
2002-11-29 23:51 ` Karl Trygve Kalleberg
0 siblings, 1 reply; 10+ messages in thread
From: Per Wigren @ 2002-11-29 23:22 UTC (permalink / raw
To: George Shapovalov, gentoo-dev
Friday 29 November 2002 20:43 skrev George Shapovalov:
> Hi guys.
>
> Yes this would make for a very interesting investigation ;).
After investigating a little I found that it fails compiling something like
95% or more of all packages without modification because it's so strictly
ANSI-C, so tcc is not yet an option for most C-programs.. (If it compiles
with "gcc -strict" it should compile with tcc) But for Eiffel (and other
compile-to-c languages) I think it's really great because the c-code it
generates is extremly fast ("unreadable optimized c-pseudo-assembler"), but
takes a LONG LONG time to compile with gcc..
> Just a small opinion here:
>
> On Friday 29 November 2002 11:22, Per Wigren wrote:
> > Friday 29 November 2002 19:43 skrev Karl Trygve Kalleberg:
> > > On Fri, 29 Nov 2002 18:41:12 +0100
>
> [skipped]
>
> > I don't know about XFree, but I don't think there should be a problem..
> > TCC supports 100% of ANSI-C, 90% of C99-specific things and the most
> > common GCC-extensions.. I read somewhere that they pass all test but 10
> > or so in GCC's testsuite (which has THOUSANDS of tests!)..
>
> So this does have a potential for breakage in various packages. Even if it
> were 100% gcc compatible we shouldn't trust it without doing a really
> extensive testing. Besides many people will choose to have a "more
> coherent" system based solely on gcc and will be glad to pay the price in
> compile time. Therefore I think use of tcc should be made optional (even
> opt-in in the beginning if you ask me). New use flag suits this very well
> and I think is completely warranted (and for the same reason I do not like
> putting this into DEPEND).
>
> George
Agreed. But I still think gobo should be an exception.. 3 hours on my pretty
fast machine vs a minute using tcc is a HUGE win! The Gobo tools are only
used when compiling other Eiffel-packages anyway.. It contains
Eiffel-replacements for C-stuff like flex, bison/yacc, cpp (preprocessor) and
more.. It's not used at runtime..
// Wigren
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 23:22 ` Per Wigren
@ 2002-11-29 23:51 ` Karl Trygve Kalleberg
2002-11-30 0:30 ` Fernand Albarracin
0 siblings, 1 reply; 10+ messages in thread
From: Karl Trygve Kalleberg @ 2002-11-29 23:51 UTC (permalink / raw
To: gentoo-dev
On Sat, 30 Nov 2002 00:22:17 +0100
Per Wigren <wigren@home.se> wrote:
> Agreed. But I still think gobo should be an exception.. 3 hours on my
> pretty fast machine vs a minute using tcc is a HUGE win! The Gobo tools
> are only used when compiling other Eiffel-packages anyway.. It contains
> Eiffel-replacements for C-stuff like flex, bison/yacc, cpp
> (preprocessor) and more.. It's not used at runtime..
Given the size of tcc itself, the huge win we can observe with gobo, and
the fact that gobo/eiffel is pretty esoteric even in Gentoo circles, I
think we should default to DEPEND="dev-lang/tcc-<version>" for now.
Eventually, it would be nice to have a tcc useflag, but if it's in reality
only applicable for this one package, there will be little use for it. As
tcc starts being able to compile other packages _AND_ those packages
exhibit a noticeable improvement in compilation time, I suggest we
introduce the useflag.
In the meantime, we should just make it easy for people to modify the
ebuild to not avail itself of tcc, for the people who feel a strong
loyalty towards gcc ;)
In time, it would of course be really, really sweet to have
package-specific useflags and package-specific default useflag settings,
so that we could do something like:
# emerge --show-options gobo
Useflag (default setting):
tcc (on)
whatever (off)
...
# USE="+tcc" emerge gobo
But that's for another time.
Kind regards,
Karl T
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-29 23:51 ` Karl Trygve Kalleberg
@ 2002-11-30 0:30 ` Fernand Albarracin
2002-11-30 14:17 ` Karl Trygve Kalleberg
0 siblings, 1 reply; 10+ messages in thread
From: Fernand Albarracin @ 2002-11-30 0:30 UTC (permalink / raw
To: gentoo-dev
Hi,
On Sat 30 Nov 2002 at 00:51:59 +0100, Karl Trygve Kalleberg wrote:
> Given the size of tcc itself, the huge win we can observe with gobo, and
> the fact that gobo/eiffel is pretty esoteric even in Gentoo circles, I
> think we should default to DEPEND="dev-lang/tcc-<version>" for now.
> Eventually, it would be nice to have a tcc useflag, but if it's in reality
> only applicable for this one package, there will be little use for it. As
> tcc starts being able to compile other packages _AND_ those packages
> exhibit a noticeable improvement in compilation time, I suggest we
> introduce the useflag.
How about simply using an environnement variable such as CC ? The user
would set it in /etc/make.conf as he already does with CFLAGS and
friends. But he would propably do the following instead :
CC=tcc; CFLAGS=-g; emerge stuff
CC would even allow to have multiple GCC version to choose from
(right?). And the best from a maintainer point of view: no
ebuild-specific work required.
Fernand
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-dev] gcc vs tcc
2002-11-30 0:30 ` Fernand Albarracin
@ 2002-11-30 14:17 ` Karl Trygve Kalleberg
0 siblings, 0 replies; 10+ messages in thread
From: Karl Trygve Kalleberg @ 2002-11-30 14:17 UTC (permalink / raw
To: gentoo-dev
On Sat, 30 Nov 2002 01:30:40 +0100
Fernand Albarracin <fernand8@wanadoo.fr> wrote:
> Hi,
>
> How about simply using an environnement variable such as CC ? The user
> would set it in /etc/make.conf as he already does with CFLAGS and
> friends. But he would propably do the following instead :
>
> CC=tcc; CFLAGS=-g; emerge stuff
>
> CC would even allow to have multiple GCC version to choose from
> (right?). And the best from a maintainer point of view: no
> ebuild-specific work required.
In this case, the problem is that the user will have to be informed of
that _before_ doing the gobo compilation. As per ebuild rules, we are not
allowed to stop the build process and ask the user for input, so at best,
he'd see a notice scrolling by at high speed saying "this package would
take 2mins to compile if you have chosen tcc, but you haven't, too bad for
you".
I certainly agree with you that the CC=tcc is a nicer approach (perhaps
even the nicest approach of them all), but it requires the user to
actually _know_ he can benefit from using tcc on gobo beforehand. That's a
very steep requirement imho, given the fact that very few people have
heard of tcc, nobody's heard of gobo, and it's hardly commonplace to think
you can get a 30x improvement in compilation time just by switching
compilers :)
Kind regards,
Karl T
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-11-30 14:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-29 17:41 [gentoo-dev] gcc vs tcc Per Wigren
2002-11-29 18:43 ` Karl Trygve Kalleberg
2002-11-29 19:22 ` Per Wigren
2002-11-29 19:43 ` George Shapovalov
2002-11-29 23:22 ` Per Wigren
2002-11-29 23:51 ` Karl Trygve Kalleberg
2002-11-30 0:30 ` Fernand Albarracin
2002-11-30 14:17 ` Karl Trygve Kalleberg
2002-11-29 19:27 ` Sven Vermeulen
2002-11-29 20:39 ` Per Wigren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox