Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GCC 4.1.0 - is it safe/worth ?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Kidel Fastro
n00b
n00b


Joined: 05 Apr 2006
Posts: 29
Location: Kraków / Poland

PostPosted: Wed Apr 05, 2006 8:25 am    Post subject: GCC 4.1.0 - is it safe/worth ? Reply with quote

Hello!

I was wondering weather it is a good idea to upgrade gcc from 3.4.5 to 4.1.0 or maybe I should pick 4.0.3 ?
What are the main benefits of upgrading gcc to ver 4.x.x ?
Is it safe ?
_________________
He who makes a beast of himself gets rid of the pain of being a man.
Back to top
View user's profile Send private message
nbvcxz
Guru
Guru


Joined: 02 Sep 2005
Posts: 379
Location: Kraków / PL

PostPosted: Wed Apr 05, 2006 8:45 am    Post subject: Reply with quote

I think the best idea is to upgrade to 4.1.0. I used 4.0.1 for a short time and what I remember was that binaries are much more bigger than 3.4.x and overall system performance decreased. From the last quarter of 2005 I use gcc-4.1 the whole system is stable and fast. Benefits - fasterAny problems with compiling were only because of -frepo and sometimes -ftree-vectorize. There are few programs that make some problems with gcc-4.1.0 but they are not most important system parts (you can find them and in most cases solutions at: https://forums.gentoo.org/viewtopic-t-444489.html or if you like experiments: https://forums.gentoo.org/viewtopic-t-441799.html). So my vote is for 4.1.0

btw nice nick
_________________
nBVCXz
zen-kernel (bfq compcache) | /tmp -> tmpfs | ext4 | zsh | xfce | schedtool
Back to top
View user's profile Send private message
Kidel Fastro
n00b
n00b


Joined: 05 Apr 2006
Posts: 29
Location: Kraków / Poland

PostPosted: Wed Apr 05, 2006 9:09 am    Post subject: Reply with quote

Quote:
* Compiling will be slower compared to almost any other version of GCC. If you are only interested in fast compiling to have a smaller code/compile/test cycle, think twice about using this compiler.


heh i tought it ll be faster :)

Thanks nbvcxz. I will have a try.
_________________
He who makes a beast of himself gets rid of the pain of being a man.
Back to top
View user's profile Send private message
nbvcxz
Guru
Guru


Joined: 02 Sep 2005
Posts: 379
Location: Kraków / PL

PostPosted: Wed Apr 05, 2006 9:18 am    Post subject: Reply with quote

Quote:
* Compiling will be slower compared to almost any other version of GCC. If you are only interested in fast compiling to have a smaller code/compile/test cycle, think twice about using this compiler.

the process of compiling is known to be slower but final code is known to be faster in work (than gcc-3.4.x), about size - in general the sizes of compiled programs are the same as with gcc-3.4.x (sometimes little bigger, sometimes little smaller, but in most cases almost identical - if you are going to upgrade your system please list and save the size of your binaries and libraries to compare it with gcc-4.1.0 after upgrade)

one thing more - I use my old PC for gentoo that's why I'm interested in small binaries - so my flags are:
CFLAGS="-Os -march=pentium3 -pipe -s -ftree-vectorize -ffast-math -fno-ident -mmmx -msse -DNDEBUG -DG_DISABLE_ASSERT -DNO_DEBUG"
CXXFLAGS="-Os -march=pentium3 -pipe -s -ftree-vectorize -ffast-math -fno-ident -mmmx -msse -DNDEBUG -DG_DISABLE_ASSERT -DNO_DEBUG -fvisibility-inlines-hidden -fno-enforce-eh-specs -frepo"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -s"

_________________
nBVCXz
zen-kernel (bfq compcache) | /tmp -> tmpfs | ext4 | zsh | xfce | schedtool
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Wed Apr 05, 2006 10:07 am    Post subject: Reply with quote

Is worth, there's a speed increase even with the same flags as ever, and using ftree-vectorize flag the speed
increase is really good..... for a speed comparison, at least for 3D intensive apps, check Blender render time comparation .

To see of my actual 869 packages (they were 856 when I switched to gcc-4.1) the ones givin issue at compile time
check Porting to gcc-4.1: my package that needed a fix.

P.S.: I got compile time errors just for final packages, no dependancies needed to be fixed.
_________________
Every day a new distro comes to birth. Every day a distro "eats" another.
If you're born distro, no matter what, start to run.
---- http://www.linuxprinting.org/ ---- http://tuxmobil.org/
Back to top
View user's profile Send private message
Kidel Fastro
n00b
n00b


Joined: 05 Apr 2006
Posts: 29
Location: Kraków / Poland

PostPosted: Wed Apr 05, 2006 10:12 am    Post subject: Reply with quote

Ok, thanks. I ll upgrade to gcc 4.1.0 but I am not going to rebuild my system which is working very nice and its not worth rebuilding. I got p4 3.2GHz and 1GB RAM so i dont think I will see any difference ;)

Regs!
_________________
He who makes a beast of himself gets rid of the pain of being a man.
Back to top
View user's profile Send private message
vipernicus
Veteran
Veteran


Joined: 17 Jan 2005
Posts: 1462
Location: Your College IT Dept.

PostPosted: Wed Apr 05, 2006 4:20 pm    Post subject: Reply with quote

Kidel Fastro wrote:
Ok, thanks. I ll upgrade to gcc 4.1.0 but I am not going to rebuild my system which is working very nice and its not worth rebuilding. I got p4 3.2GHz and 1GB RAM so i dont think I will see any difference ;)

Regs!


I think you should rebuild, I think it's kind of weird that you don't want your whole system recompiled with GCC 4.1, but just apps from now on. You don't really get much added benefit from that. Maybe you'd be interested in checking out E-Mission Install Guide, Nesl247 has done alot of work in making stage3's for GCC 4.1 and making using the newer toolkits very easy.
_________________
Viper-Sources Maintainer || nesl247 Projects || vipernicus.org blog
Back to top
View user's profile Send private message
AaronPPC
Guru
Guru


Joined: 29 May 2005
Posts: 522
Location: Tucson, AZ

PostPosted: Wed Apr 05, 2006 6:44 pm    Post subject: Reply with quote

I don't know if this is a good question to ask since everyone has their favorite optimizer setting...

I have tried -O2, -O3, and am currently using -Os. I like -O2 best and am awaiting another GCC upgrade before I switch back. Would I find -O2 the best setting under GCC-4.1?
_________________
--Aaron
Back to top
View user's profile Send private message
ShadowWizzard
n00b
n00b


Joined: 04 Mar 2006
Posts: 70

PostPosted: Thu Apr 06, 2006 7:05 pm    Post subject: Wonder.. Reply with quote

I'm wondering about this flag set ...

Quote:
CFLAGS="-Os -march=pentium3 -pipe -s -ftree-vectorize -ffast-math -fno-ident -mmmx -msse -DNDEBUG -DG_DISABLE_ASSERT -DNO_DEBUG"


1st -
Code:
-s
switch is making the symbolic information unavaiable - what is perhaps not so good choice
for some libaries. For example with like this switch linking against openjade failed. Is this is a big factor for speed up ?
2nd -
Code:
-mmmx -msse
- I also used
Code:
 -msse2 -m3dnow
- but then compile failed for ex. for textinfo
and GCC 4.1 itself. So my concern is - and what I can't find in GCC man - is the switch
Code:
 -march=athalon-xp

implies also the
Code:
 -mmmx -mmsse -msse2 -m3dnow
? If so then it's strange that adding this options additionally
makes some ebuilds fail. If not it's also strange why ? The GCC knows that CPU is athlon-xp and should enable the mmx
sse sse2 extensions as well ...

So can anybody write a short summary about these 2 items. :?:
Back to top
View user's profile Send private message
irondog
l33t
l33t


Joined: 07 Jul 2003
Posts: 715
Location: Voor mijn TV. Achter mijn pc.

PostPosted: Thu Apr 06, 2006 7:27 pm    Post subject: Reply with quote

AaronPPC wrote:
Would I find -O2 the best setting under GCC-4.1?
It's more stable than -O3 and -Os at least.
_________________
Alle dingen moeten onzin zijn.
Back to top
View user's profile Send private message
zxy
Veteran
Veteran


Joined: 06 Jan 2006
Posts: 1160
Location: in bed in front of the computer

PostPosted: Thu Apr 06, 2006 7:32 pm    Post subject: Reply with quote

to Matteo Azzali:

You could use -frename-registers in cflags, for athlon64 -fweb is also cool (don't know for your proc)
And try to recompile glibc - it can give a big boost. Sometimes recompiling glibc can give better results than just the package, because math libraries are also in glibc. Use glibc 2.4. and nptl and nptlonly use flags. Report the difference.

P.S. could you post the link for the hairball source file. I'd like to render it on my amd64.
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Sun Apr 09, 2006 12:18 pm    Post subject: Reply with quote

zxy wrote:
to Matteo Azzali:

You could use -frename-registers in cflags, for athlon64 -fweb is also cool (don't know for your proc)
And try to recompile glibc - it can give a big boost. Sometimes recompiling glibc can give better results than just the package, because math libraries are also in glibc. Use glibc 2.4. and nptl and nptlonly use flags. Report the difference.

P.S. could you post the link for the hairball source file. I'd like to render it on my amd64.


Now I'm already using glibc-2.4-r1 (switched after the test),instead nptl and nptlonly where on during the test,
I'll search the testfile I used to make report more complete.

However my glibc is compiled with plain "-O2 -march=athlon-xp -pipe -fomit-frame-pointer", should I reemerge glibc with more
optimized flags? With glibc 2.4-r1 unhoptimized I think there's a little slowdown for the blender optimized version
(may be pax-utils, I changed lots of other things on this system from when I did that test).....

The hairball (is not the file tested for speed! I needed this one to have a render done outside my machine when checking
for artifacts) is inside blender240 test package
_________________
Every day a new distro comes to birth. Every day a distro "eats" another.
If you're born distro, no matter what, start to run.
---- http://www.linuxprinting.org/ ---- http://tuxmobil.org/
Back to top
View user's profile Send private message
zxy
Veteran
Veteran


Joined: 06 Jan 2006
Posts: 1160
Location: in bed in front of the computer

PostPosted: Sun Apr 09, 2006 3:16 pm    Post subject: Reply with quote

I have global cflags set and my glibc is compiled with it's defaults. On the contrary I noticed some improvement in speed after upgrading to 2.4 series. Maybe it is connected to the fact that I upgraded gcc at the same time to 4.0.3 and later to 4.1.0.
For glibc you can use some overlays with extra performance patches, but I don't have good experience with this. I leave glibc as it is, but i understand some improvement can be achieved with patching glibc.

In my opinion it is important to know for which processor you are setting cflags. If you have a celeron with small L2 cache setting -funroll-all-loops would slow the program down, as you would fill the cache quickly and smaller code would run much faster. (IMHO)
I favor -frename-registers because on my machine (athlon64) i have sse3 and it is not in athlon64 normaly, so i add -msse3 with my favorite flag (rename-reg) to optimize.

Maybe you would see the difference running blender as root, becasuse as I've heard only root has direct memory access, but don't hold me on this one. And you can also try runing it with different nice values. Like:
Code:
nice -n -10 blender

you can set nice value from -20 to 20, but do this as root. value -20 full priority, 20 low priority.


Hope this helps in any way.

------------------------------------------------------------------------------------
CFLAGS="-fall-possible-flags" can make slalom from downhill
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Sun Apr 09, 2006 6:41 pm    Post subject: Reply with quote

I'm unsure if we have the same version of gcc-4.1 , however in my system (sempron 3100+ Rev.E , is 64 bits and has sse3)
addin -frename-registers and -msse3 slowed blender down....
The best config here seems "-03 -march-athlon-xp -ftree-vectorizer -msse -msse2 -ftree-vectorize-verbose=1 -pipe -fomit-frame-pointer -mfpmath=sse"

I still have to try to re-emerge gcc and glibc with these flags, I'm using safer "-O2 -march-athlon-xp -pipe -fomit-frame-pointer" for now...
_________________
Every day a new distro comes to birth. Every day a distro "eats" another.
If you're born distro, no matter what, start to run.
---- http://www.linuxprinting.org/ ---- http://tuxmobil.org/
Back to top
View user's profile Send private message
nesl247
Veteran
Veteran


Joined: 15 Jun 2004
Posts: 1614
Location: Florida

PostPosted: Sun Apr 09, 2006 6:55 pm    Post subject: Reply with quote

Do GTK+ apps still crash with -ftree-vectorizer?
Back to top
View user's profile Send private message
prymitive
Apprentice
Apprentice


Joined: 13 Jun 2004
Posts: 260

PostPosted: Tue Apr 11, 2006 7:22 pm    Post subject: Reply with quote

I just finished rebuilding system with gcc 4.1 on my Turion based notebook (x86) and if I remeber correctly just after kde is loaded my system was using abou 95 MB of RAM, now free -m shows 69 MB used. Again I'm not 100% if it was 95 before but it was somewhare near 100MB for sure (I was using 3.4.5-r1 before). Can someone confirm this? I did not alter CFLAGS but I added --as-needed to LDFLAGS so maybe that's the reson, I also rebuilded KDE with -fvisibility support.
Back to top
View user's profile Send private message
zxy
Veteran
Veteran


Joined: 06 Jan 2006
Posts: 1160
Location: in bed in front of the computer

PostPosted: Thu Apr 13, 2006 12:54 am    Post subject: Reply with quote

Might be interesting to see this two links. They are about Povray benchmarks considering gcc 4 and gcc 3.4. One interesting thing might be, which cflags author used and then compile blender with them.

Here are the links
GCC 3.4.4: http://gcc.gnu.org/ml/gcc/2005-01/msg01424.html
GCC 4.0: http://gcc.gnu.org/ml/gcc/2005-01/msg01344.html
Back to top
View user's profile Send private message
nejiron
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2004
Posts: 95
Location: U.S.A.

PostPosted: Mon Apr 17, 2006 2:37 pm    Post subject: Reply with quote

I upgraded to 4.1.0 with little to no trouble. I kept the same intense CFLAGS for everything except Open-Office, Alsa-oss, and maybe one other package. Even the kernel compiled fine with aggressive CFLAGS.

The only thing that stopped working were my rt2500 drivers for my wireless card. Since I can just plug my ethernet in, this did not bother me to much, although I will need to fix this problem within a month.

It is definitely worth it. Due to the limited amount of memory in my system, I keep track of how much is used. After recompiling everything in 4.1.0 I noticed that I was using at least 10% less of my memory just running the applications. If this isn't enough of a reason for you, I am sure that the applications are running faster, however I have no definitive proof.
_________________
I am a traveler of both time and space
Back to top
View user's profile Send private message
Joffer
Guru
Guru


Joined: 10 Sep 2002
Posts: 585
Location: Arendal, Norway

PostPosted: Mon Apr 17, 2006 3:17 pm    Post subject: Reply with quote

I went straight for gcc-4.1.0 (overlay) when I installed Gentoo 2006.0 about a month ago or so. And my cflags are not the sanest ones.. Not much problems to report. Perhaps only dbus which won't start, but have not found it to be gcc-4.1.0 yet.. still investigating..
_________________
As of April 2006 - Athlon64 X2 4200+ 1GB RAM - amd64-2006.0 profiled system with portage 2.1_preX, ck-sources-2.6.16, glibc-2.4-r1 (overlay w/-Bdirect&-hashvals), binutils-2.16.91.0.6 (overlay), gcc-4.1, Xorg 7
Back to top
View user's profile Send private message
kepstin
n00b
n00b


Joined: 24 Jul 2003
Posts: 8

PostPosted: Mon Apr 17, 2006 3:41 pm    Post subject: Reply with quote

Just a note, I've been using gcc 4.1 for over a month now, and have done a complete system rebuild with sane and stable cflags "-march=athlon-xp -O2 -fomit-frame-pointer -pipe". The main performance increase that I've noticed is a very large speed increase when compiling c++ code. KDE users in particular should think about switching, you'll save a lot of time on upgrades :)
Back to top
View user's profile Send private message
BrummieJim
l33t
l33t


Joined: 22 Jul 2005
Posts: 683

PostPosted: Mon Apr 17, 2006 5:04 pm    Post subject: Reply with quote

So it looks like people think;
i.) compiled programs are about the same size
ii.) Memory usage is about 10% down
iii.) Compiles are faster.

but the povray example seemed to show 3.4 was faster. Apart from this, with standard flags, what kind of speed improvements are people getting using 3.4.1. I know that's a difficult question, but less than 10% isn't really worth the risk in terms of system stability.


edit; just noticed the povray example was talking about 3.4.0, so a bit off topic.
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Mon Apr 17, 2006 5:11 pm    Post subject: Reply with quote

BrummieJim wrote:

but the povray example seemed to show 3.4 was faster. Apart from this, with standard flags, what kind of speed improvements are people getting using 3.4.1. I know that's a difficult question, but less than 10% isn't really worth the risk in terms of system stability.


edit; just noticed the povray example was talking about 3.4.0, so a bit off topic.


I'm almost sure this is a glibc-2.4 issue, since blender was going faster with gcc-4.1 and glibc-2.3.x , while with glibc-2.4 it's goin almost at the same speed
(just a little faster) of my old version compiled with gcc-3.4.6.....
_________________
Every day a new distro comes to birth. Every day a distro "eats" another.
If you're born distro, no matter what, start to run.
---- http://www.linuxprinting.org/ ---- http://tuxmobil.org/
Back to top
View user's profile Send private message
karr
Tux's lil' helper
Tux's lil' helper


Joined: 03 Feb 2004
Posts: 120
Location: albuquerque

PostPosted: Mon Apr 17, 2006 5:29 pm    Post subject: Reply with quote

Quote:
but the povray example seemed to show 3.4 was faster.

The other thing to remember is that those numbers are for gcc 4.0 not 4.1, which almost certainly has a performance impact. Does anyone know if we have 4.1 numbers somewhere?
Back to top
View user's profile Send private message
andyknownasabu
Apprentice
Apprentice


Joined: 06 Feb 2003
Posts: 281
Location: Zurich, Switzerland

PostPosted: Tue Apr 18, 2006 9:01 am    Post subject: Reply with quote

I'm using gcc-3.4.6-r1 at the moment and after having read all the positive
reports in this thread I would like to change to gcc-4.1.

Just a short question:
Is it possible and safe to do a "smooth" recompile of all packages?
I think of recompiling for example glibc and kdelibs but from then on just
the packages that get updated anyway in portage.

I'm using the following CFLAGS:
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

If this is not possible/safe:
What is the best way to do a complete system rebuild of all packages?

Thanks in advance!
_________________
Please, also have a look at:
Global Marshall Plan Initiative
http://www.globalmarshallplan.org/
Back to top
View user's profile Send private message
DarkMind
Guru
Guru


Joined: 18 Dec 2003
Posts: 525
Location: Santiago, Chile

PostPosted: Tue Apr 18, 2006 9:25 am    Post subject: Reply with quote

i have all my system compiled ith gcc 4.1 with no problems, works fast and stable :)

some packages not compile, but the ~x86 version of this packages works fine

now i'm recompiling all my system to gcc 4.2 alpha for try :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2, 3, 4, 5, 6  Next
Page 1 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum