Apt-build is a package that lets you compile the packages from scratch and optimizing them. It approaches all the advantages of apt. There are many options, unfortunately not as much as in Gentoo’s Portage package system.

For unfeared users, there is an options that recompiles the entire system.