Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Yet another question about make.conf and optimization
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64
View previous topic :: View next topic  
Author Message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 420
Location: France

PostPosted: Mon Jul 31, 2006 10:03 pm    Post subject: Yet another question about make.conf and optimization Reply with quote

I have an ~amd64 system with the following specs :
Code:

# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-O2 -pipe -march=k8 -msse3"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
ACCEPT_KEYWORDS="~amd64"
USE="-gtk -gnome kde qt alsa arts ogg vorbis xcomposite samba nvidia a52 aac ffmpeg v4l dvd dvb hal dvdr musepack flac dvdread v4l2 nsplugin pdf mplayer matroska mp4 mozilla browserplugin apache2 mp3 mad vcd mpeg2 glitz cairo nptl nptlonly kdehiddenvisibility kdeenablefinal bitmap-fonts truetype-fonts type1-fonts jack lirc"
LINGUAS="fr fr_FR"
VIDEO_CARDS="nvidia"
INPUT_DEVICES="keyboard mouse"
LIRC_DEVICES="--with-driver=devinput"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/overlays/xgl-coffee"

This system works correctly, but i'm going to buy a new hard disk, and to reinstall my system. I would like something faster but stable (no overlay for glibc, gcc... ) too. I think i'll use the following config :
Code:

CFLAGS="-march=k8 -O2 -pipe -msse3"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -s"
USE="glibc-omitfp nptl nptlonly sse sse2 sse3 3dnow 3dnowext mmx mmxext"


What do you think of this make.conf? Are these optimizations correct to make my system faster? Do you have other tips to improve this make.conf?

Thank you in advance. :)


Last edited by Tom_ on Tue Aug 01, 2006 11:07 am; edited 1 time in total
Back to top
View user's profile Send private message
sonicbhoc
Veteran
Veteran


Joined: 24 Oct 2005
Posts: 1805
Location: In front of the computer screen

PostPosted: Mon Jul 31, 2006 10:13 pm    Post subject: Reply with quote

Looks good to me, but I'm no expert on flags like that. I know Kororaa (I spelled it wrong) Linux uses similar LDFLAGS so I'm going to say go for it..
Back to top
View user's profile Send private message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 420
Location: France

PostPosted: Tue Aug 01, 2006 11:05 am    Post subject: Reply with quote

Thank you for your reply. ;)
Other advice?

Thank you in advance.
Back to top
View user's profile Send private message
palatin
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2004
Posts: 113
Location: Paris

PostPosted: Tue Aug 01, 2006 11:55 am    Post subject: Reply with quote

You may want to look into using --hash-style optimisations. There is a long thread about it in the Unsupported forum.
It will eventually go mainstream, so it should be safe to use. (Well, it has already been merged in binutils/glibc.)
_________________
fumo~
Back to top
View user's profile Send private message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 420
Location: France

PostPosted: Tue Aug 01, 2006 4:37 pm    Post subject: Reply with quote

Yes i know --hash-style optimisations but i thought it was too unstable. Perhaps, I'll try this optimisation.

Thank you for your reply. :)
Back to top
View user's profile Send private message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Tue Aug 01, 2006 6:38 pm    Post subject: Reply with quote

CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"

shouldn't be required, most packages which benefit from visibility-hidden are already using it.
Back to top
View user's profile Send private message
stobbsm
Guru
Guru


Joined: 23 May 2004
Posts: 452

PostPosted: Wed Aug 02, 2006 7:07 am    Post subject: Reply with quote

I use
Code:
CFLAGS="-O2 -march=athlon64 -mtune=athlon64 -pipe -fomit-frame-pointer -msse3 -mfpmath=sse,387"


The -mfpmath=sse,387 is new for me, and seems to have sped things up a bit. Don't have numbers to compare it to, but everything is smooth with almost no wait time.
_________________
Sysadmin of Ubuntu systems and servers....
Although my own server is gentoo....
Back to top
View user's profile Send private message
Maedhros
Bodhisattva
Bodhisattva


Joined: 14 Apr 2004
Posts: 5511
Location: Durham, UK

PostPosted: Wed Aug 02, 2006 8:12 am    Post subject: Re: Yet another question about make.conf and optimization Reply with quote

Tom_ wrote:
Code:
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -s"

You're probably not going to get any official support with those - both have been known to cause unexpected linking errors, so any bugs you file are likely to be returned with "recompile your system without those flags". I honestly don't think CFLAGS/CXXFLAGS beyond selecting the right -march value make your system noticably faster, and neither -fvisibility-inlines-hidden nor --as-needed have any effect on code optimisation anyway. :wink:
_________________
No-one's more important than the earthworm.
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Wed Aug 02, 2006 10:18 pm    Post subject: Reply with quote

http://www.gentoo.org/proj/en/qa/asneeded.xml
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10310
Location: Córdoba (Spain)

PostPosted: Wed Aug 02, 2006 10:39 pm    Post subject: Reply with quote

Fancy cflags are nice to put in a poster in your bedroom, if that makes someone to dream with his/her box being a Plentium XX :P But in the real life, they are not there for a reason. If a dev consider that a flag is important for anything, s/he will put it into the makefile for his/her app. If not, portage will sometimes filter crappy cflags cause a lot of stuff just breaks.

The speed gain, if any, is not certainly appreciable by the -average- human's temporal sense, so, I would not worry too much about it. Cflags can certainly be used under some conditions, cause they can cause a speed up, but under many others, they can cause the oppositte effect. If someone talks about "noticeable" effects, s/he is just giving arbitrary arguments, like those who says that wine is at least twice as tasty as beer. Speed benchmarks can show that, under most conditions, those flags are nothing relevant, for some apps, they can speed the thing up a bit, or another, they will slow down things. But, for sure, they will, sooner or later, cause trouble.

Just that, from time to time I put a similar post though I know that no one cares about this. :P

Happy ricing and regards. :)

EDIT, small typo.
Back to top
View user's profile Send private message
Varean
Guru
Guru


Joined: 03 Jul 2005
Posts: 436
Location: California, USA

PostPosted: Thu Aug 03, 2006 12:32 am    Post subject: Reply with quote

Hate to add another question, but I noticed you have the -msse3 flag. Do all AMD 64's have msse3?
_________________
Registered Linux User #387568
Back to top
View user's profile Send private message
i92guboj
Bodhisattva
Bodhisattva


Joined: 30 Nov 2004
Posts: 10310
Location: Córdoba (Spain)

PostPosted: Thu Aug 03, 2006 12:35 am    Post subject: Reply with quote

Varean wrote:
Hate to add another question, but I noticed you have the -msse3 flag. Do all AMD 64's have msse3?


No.

Code:
# uname -a
Linux pinkroom 2.6.17.1 #13 Sun Jul 30 18:53:09 CEST 2006 x86_64 AMD Sempron(tm) Processor 3000+ AuthenticAMD GNU/Linux

# cat /proc/cpuinfo | grep flags
flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow lahf_lm


EDIT, added uname info about the cpu model

EDIT2, you might be interested in this wiki: http://en.wikipedia.org/wiki/SSE3

You need to look for "pni" in between those flags, as you can see, my listing does not hold any "pni" string on it.
Back to top
View user's profile Send private message
get sirius
Guru
Guru


Joined: 27 Apr 2002
Posts: 316
Location: Madison, WI

PostPosted: Thu Aug 03, 2006 1:25 am    Post subject: Re: Yet another question about make.conf and optimization Reply with quote

Tom_ wrote:

[/code]
This system works correctly, but i'm going to buy a new hard disk, and to reinstall my system. I would like something faster but stable (no overlay for glibc, gcc... ) too. I think i'll use the following config :
Code:

CFLAGS="-march=k8 -O2 -pipe -msse3"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--sort-common -s"
USE="glibc-omitfp nptl nptlonly sse sse2 sse3 3dnow 3dnowext mmx mmxext"


What do you think of this make.conf? Are these optimizations correct to make my system faster? Do you have other tips to improve this make.conf?

Thank you in advance. :)


sse, sse2, 3dnow 3dnowext, mmx, mmxext are all included by a CHOST that specifies x86_64; the Gentoo developers wrote it up that way so you wouldn't have to clog your make.conf with features that the cpu executes by design. sse3 must be added if you have one of the 90nm cores because the kernel cannot tell which x86_64 core you are using. And, parenthetically, adding fluffy flags to your make.conf will gain you no speed but will almost certainly break applications.
Back to top
View user's profile Send private message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 420
Location: France

PostPosted: Thu Aug 03, 2006 6:58 am    Post subject: Reply with quote

Thank you for your replies. :)
So now i think i'm going to use CXXFLAGS="${CFLAGS}" instead of CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden".

For LDFLAGS, i think i'll use LDFLAGS="-Wl,-O1 -Wl,--as-needed" because -Wl,-O1 works correctly on my system. Since, as-needed allows the linker to avoid linking extra libraries in a binary, it must speed up?
Back to top
View user's profile Send private message
Enverex
Guru
Guru


Joined: 02 Jul 2003
Posts: 501
Location: Worcester, UK

PostPosted: Thu Aug 03, 2006 8:01 am    Post subject: Reply with quote

Tom_ wrote:
Thank you for your replies. :)
So now i think i'm going to use CXXFLAGS="${CFLAGS}" instead of CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden".

For LDFLAGS, i think i'll use LDFLAGS="-Wl,-O1 -Wl,--as-needed" because -Wl,-O1 works correctly on my system. Since, as-needed allows the linker to avoid linking extra libraries in a binary, it must speed up?


And also helps avoid catastrohpies like the Expat one a little while back...
Back to top
View user's profile Send private message
Gergan Penkov
Veteran
Veteran


Joined: 17 Jul 2004
Posts: 1464
Location: das kleinste Kuhdorf Deutschlands :)

PostPosted: Thu Aug 03, 2006 8:07 am    Post subject: Reply with quote

well I don't use any cflags, but the linker flags could work wonders :)
As-needed is mainly useful to prevent massive rebuilding of your system, because only the really needed dependancies are linked in in this way, if some package fails with this one it is definitively a bug in the package and should be reported on bugzilla, if there is no entry for it (of course correctly linking it to the tracker and if possible with a patch). It will also speed your system or let's say more precisely will not slow it down with the time :)
the hashstyle patches are by design absolutely ok - meaning that, there should be no package, which fail to link or function because of them, of course the only thing still unsupported for them on gentoo is the glibc update, so there is a serious risk involved, this said I hadn't had any problems with them :)
_________________
"I knew when an angel whispered into my ear,
You gotta get him away, yeah
Hey little bitch!
Be glad you finally walked away or you may have not lived another day."
Godsmack
Back to top
View user's profile Send private message
Tom_
Guru
Guru


Joined: 20 May 2004
Posts: 420
Location: France

PostPosted: Thu Aug 03, 2006 5:20 pm    Post subject: Reply with quote

Thank you.

I think i won't use --hash-style optimizations soon because there're too many problems : for example, you've to recompile the whole system when you update hash-style patchs so it takes too much time.

What do you think of --sort-common -s? Is it a good choice?

I know that a lot of (c, cxx or ld)flags are truly useless and i don't want to use these. I want only to speed up a little my system and to have a stable system.
Back to top
View user's profile Send private message
Enverex
Guru
Guru


Joined: 02 Jul 2003
Posts: 501
Location: Worcester, UK

PostPosted: Thu Aug 03, 2006 6:01 pm    Post subject: Reply with quote

As needed is still broken on lots of things so that may not be a good idea. It linked lots less files but when benched seemed to provide no actual speed increase in any way (which was odd).
Back to top
View user's profile Send private message
Gergan Penkov
Veteran
Veteran


Joined: 17 Jul 2004
Posts: 1464
Location: das kleinste Kuhdorf Deutschlands :)

PostPosted: Thu Aug 03, 2006 9:09 pm    Post subject: Reply with quote

Tom_ wrote:
Thank you.

I think i won't use --hash-style optimizations soon because there're too many problems : for example, you've to recompile the whole system when you update hash-style patchs so it takes too much time.

What do you think of --sort-common -s? Is it a good choice?

I know that a lot of (c, cxx or ld)flags are truly useless and i don't want to use these. I want only to speed up a little my system and to have a stable system.

You don't need to recompile world, I mean your system will still function (I suppose here that you don't use -Bdirect now), even if you don't rebuild world, the patches are back/forward compatible with the official glibc/binutils releases (use --hash-style=both always, if you decide to use it), the problem was with some of us, who used some older versions of the hashstyle patches or the -Bdirect (which was not officialy sanctioned - and one of the reasons for this was this flaky implementation - though not the main).
It is the same as with --as-needed, if you recompile your world you will see benefits, if not it will still function :)
The hashstyle is just a new section in the so-header, it duplicates the now used section with more effective hashes - resulting in faster runtime linking nothing less nothing more - it will speed the startup time of the applications.
Enverex wrote:
As needed is still broken on lots of things so that may not be a good idea. It linked lots less files but when benched seemed to provide no actual speed increase in any way (which was odd).

As I said --as-needed is not a ricer flag per design, it makes the linker more useful and more stricter, it enforces the real dependancies and almost all the packages, which are broken with it are broken upstream...
So it does not make your computer faster, well I'm fine with this, as long I don't need to fight my way through the expat nightmare - it is a valid reason for me to use it:)
_________________
"I knew when an angel whispered into my ear,
You gotta get him away, yeah
Hey little bitch!
Be glad you finally walked away or you may have not lived another day."
Godsmack
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on AMD64 All times are GMT
Page 1 of 1

 
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