Will a package I compile myself perform better than installing from the repositories?

Does a package performance is different when it's compiled from sources, or installed from repository ? Is it possible, what during the compilation, the package will be "more adapted" (performance, stability) to Your system, if it's compiled on it ?


Solution 1:

Unless you are doing serious optimization during the build, or making significant changes to what features you are building, for very complex programs, it is very unlikely you will see any performance benefit. And even with the serious optimizations, you will still only see minimal improvement. There's no real advantage to building applications in such a manner, on Ubuntu, for the most part.

Solution 2:

You will not get any performance boost if you recompile things on your system, unless your Ubuntu is highly customized, like using a lot of core libraries from another source.

The trick is that all packaged for Ubuntu are build on a real Ubuntu system, which uses the same packages at yours. That means that the building environment is 100% the same system, all libraries have identical bindings etc, only user config differs. Because of that, when binary packages are build, a lot of aggressive optimization can be applied, and they will be still valid on your system. This way Ubuntu can provide users with packages whose performance is maximized.

The chance that packages you compile on your own will have better performance is very low. It's even probable that they will be working slower, because a lot of optimization which is not enabled by default is manually triggered when building packages for Ubuntu repositories.

Concerning stability, the reasoning is the same. Because packages are build on an Ubuntu system, which has exactly the same libraries as you do (provided you got them from repositories), there will be no difference in their behavior.

Concluding, do not expect any profits when building apps on your own.

However, if you use custom, modified libraries or core packages, that do not originate from Ubuntu repositories, it may be beneficial to rebuild applications which use them. However, most probably the difference will be so small that difficult to notice, so it may be not worth the hassle.