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 ?
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.
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.
I am a statistician who works in R. I am using a dual-boot system (Ubuntu/Windows 7). When I installed R from the Ubuntu repository (r-base, r-base-dev, ...), its performance was terrible! The time it took to run a certain script (calculate the trajectory of a particle in a loop) was 50% longer than on Windows! Disheartened, I purged the version of R supplied by Ubuntu and compiled my own with
"-march=native -O3" flags for all compilers (
FCFLAGS), and the result was... impressive to say the least. My scripts were running twice as fast as on Windows 7. Besides that, sometimes, official repositories contain prehistoric versions of libraries, and a developer might want to compile fresh libraries every time.
Besides that, I also compiled the Linux kernel, but the gains were much more modest (5%). So it really depends on the software, how much it gains by using your native architecture etc. Some chess engines (like Stockfish) rely on
popcnt instructions, so if the default compiled binary—jack of all processors, master of the oldest—does not support the cool new stuff your processor is capable of, consider compiling it.
Generally no, but there are exceptions here and there.
- Compiling Firefox 18 from source with flags "-march=native -pipe -O2" seemed to decrease those little periods of unresponsiveness during page loads, but nothing else changed. Compiling it with flags "-march=native -pipe -Os" made it 16.5MB smaller in RAM. It launched noticably faster as a consequence, and seems to take up less RAM with 30+ tabs open, but all the menu options seemed to take forever.
- Compiling OpenArena from source with flags "-march=native -pipe -O2" increased avg framerate from 28.7 (timedemo results) to 33.4 over install from repository. That's a big improvement.
Everything else I've compiled from source either has , runs roughly the same, or sometimes breaks/runs like crap.