The Mozilla build system contains support for building with Profile-Guided Optimization (PGO) with GCC 4 or newer and Microsoft Visual C++ 2005 (Professional Edition) or newer. A PGO build consists of two passes: a first pass to build instrumented binaries, then a second pass to re-build optimized binaries using profile information gleaned from running the instrumented binaries. The Mozilla build system will run both passes for you, as well as a profile generation script in between.
In order to build Firefox with Profile Guided Optimizations, you should first make sure that you can do a simple build of Firefox. You need to set up the build prerequisites and environment. You must have tests enabled (do not include
--disable-tests in your build configuration). Then run
make -f client.mk profiledbuild (see the Building section below.)
The Mozilla build system will run the
pgo-profile-run make rule from
testing/testsuite-targets.mk, which in turn runs the
build/pgo/profileserver.py script. You can customize any of these two if you need the profile generation to happen differently from the default.
PGO builds require you to start your build from a different target in client.mk. Instead of the usual
make -f client.mk build, you do
make -f client.mk profiledbuild.