Performance difference between yum and self-compilation

3

How does compiling source code oneself result in better performance than using yum?

Ganesh.G.Kurup

Posted 2011-03-19T14:38:36.357

Reputation: 31

Answers

4

Well, with yum you receive a precompiled program that fits the distribution.

Choosing, source compilation on that same distribution will not give any speed-ups unless you mess with the compiler options, or build a static version that links the libraries with the binary, instead of having to link the libraries on load-time.

Thus, just downloading the source and doing compilation will not necessarily result in faster execution. In many cases it will be slower. Because the people that have prepared the package are many times more proficient and informed on this specific package than you.

However, if you know what you are doing you can configure the compiler, or even use a better compiler and edit the codebase if needed, to produce a better result.

g24l

Posted 2011-03-19T14:38:36.357

Reputation: 829

3

When you compile it the program is tailored to your hardware and doesn't contain the extra data required to make it portable. The performance gain is not noticeably though so you should not be concerned about compiling your stuff unless you are a freak about it.

Riguez

Posted 2011-03-19T14:38:36.357

Reputation: 3 594

0

Another point are dependencies.

On Unix-like systems programs often call one another and are designed to be very modular. So for example mplayer may output video using DirectFB or using aalib or libcaca or using standard fbcon framebuffer, using OpenGL video outpput, using X and so on.

If you for example don't need ACII output produced by aalib and libcaca, when compiling program, you can just disable them. On the other hand package maintainer may decide that such options are very popular and have them enabled in package.

If you use the package, parts of unneeded code remain in the program and they can slow down execution.

Sometimes, it can get worse. Package maintainer may decide to compile a program with support for some other package. Then that package is marked as dependency and will need to be installed. If your system for some reason doesn't work well with that other package installed, you won't be able to use the program you want to use because of its optional support for some package. I had such problem when PulseAudio was new. It just wouldn't work on my system and then I had problems switching to ALSA because large number of audio packages depended on Pulse, even if support for Pulse wasn't critical to package's operation.

AndrejaKo

Posted 2011-03-19T14:38:36.357

Reputation: 16 459

"If you use the package, parts of unneeded code remain in the program and they can slow down execution." I am not sure on that. Unused code delays load time in principle and increases memory usage. Unless we are talking a gross amount of code there shouldn't be a considerable slowdown. – g24l – 2011-03-25T23:14:25.107