If I want to achieve better performance from, let’s say for example, MySQLdb, I can compile it myself and I will get better performance because it’s not compiled on i386, i486 or what ever, just on my CPU. Further I can choose the compile options and so on…
Now, I was wondering if this is true also for non-regular Software, such as compiler.
Here come the 1st part:
- Will compiling a compiler like GCC result in better performance?
and the 2nd part: - Will the code compiled by my own compiled compiler perform better?
(Yes, I know, I can compile my compiler and benchmark it… but maybe … someone already knows the answer, and will share it with us =)
In answer to your first question, almost certainly yes. Binary versions of
gccwill be the “lowest common denominator” and, if you compile them with special flags more appropriate to your system, it will most likely be faster.As to your second question, no.
The output of the compiler will be the same regardless of how you’ve optimised it (unless it’s buggy, of course).
In other words, even if you totally stuffed up your compiler flags when compiling
gcc, to the point where your particular compiled version ofgcctakes a week and a half to compile “Hello World”, the actual “Hello World” executable should be identical to the one produced by the “lowest common denominator”gcc(if you use the same flags).