First I should apologize for my likely naive questions, but I have only started playing with actual optimizations in the last week or so; I have always just compiled with the defaults before.
Anyway, I have recently been playing with compiler flags through the use od SlackBuild scripts, and had a few questions and thoughts that I would like cleared up.
1. I have read in the GCC documentation that -march implies -mtune to the same CPU type. But I have seen many scripts specifying both. Is it alright that I am just using -march?
2. In the official Slackware build scripts, the following is added to ./configure:
Now, since $ARCH is also used when it names the package, I have been using "i786", even though I use "pentium4" for -march. Is this correct? I assume so, because when I give --build "pentium4", the response I get back is still:
checking build system type... i786-slackware-linux-gnu
3. Since I mainly compile my packages on a centralized server and then push them out to my machines, should I be using --host rather than --build when optimizing for a specific CPU (one which the server does not have)? At the very least I know I am misrepresenting the build machine (does this matter?), though the host machine does show up as i786 in the ./configure output.
4. Finally, I have noticed that when I build a package that should be compiled only
for Pentium 4 (if I am doing it right), I am able to run the binaries on the server. I had got the impression that once they were compiled for a specific CPU, that was it, and they would not run on a different chip (the server has an AMD XP 1500+, and my desktop has a 2.4 GHz P4). So this has gotten me thinking that I have either done something wrong and they are not fully optimized for Pentium 4, or that I was a little too gullible with what I read online about CPU optimizations.
Again, I am sorry if a lot of this is very obvious, but I have not been able to find clear explanations for some of these issues, and it seems like the kind of thing were you really want to hear other's first hand accounts to make sure you are getting the best performance. I should also note that I do "feel" a considerable performance boost in some applications (most notably, Wine) so I must be doing something right.