Why Firefox builds are slow

October 01, 2013 at 01:30 AM | categories: Mozilla

Many people ask/complain about Firefox builds being slow. They are slow. You have every right to complain.

Now in the official build system docs is a page explaining the major reasons why the build system is slow. I encourage everyone to read it. If you have any questions, ping me and I'll update the docs.

Not yet documented there are some new insights we've been getting from Mike Hommey's terrific work to optimize how make traversal works in the current build system.

As part of that work, Mike established a new compile tier in the build system. This tier compiles C/C++ and little else. Before, C/C++ compiling was interleaved with all the other build steps (install JS files, xpt processing, etc), so it was somewhat difficult to isolate the impact of compilation against all other build actions.

Now that we have all compiling happening in one isolated phase, it's pretty obvious that compiling accounts for the majority of CPU and wall time in the build system (at least with non no-op builds). We suspected this before, but we didn't have concrete numbers.

As I've been pulling and rebuilding inbound since this change landed, it's become increasing clear to me the impact of header dependency hell on build times. Even simple changesets touching a few .h files are resulting in hundreds or even thousands of C/C++ files being recompiled. This increases incremental build times from say 1.5 minutes to often over 10 minutes.

With Mike Hommey's work, I feel we finally are on a path to make no-op build times reasonable for many developers. However, until the header dependency graph is significantly reduced, developers will continue to see excessively long build times for incremental builds, especially on pulls. (I notice that my daily inbound pulls take about as long as a clobber build, which means practically every .cpp file is invalidated every day due to .h changes.)

Fortunately, great work has been happening to minimize C/C++ header dependency hell recently. To everyone working on that, everyone who builds Firefox owes you a giant thank you. However, there's much more that can be done. While you've made terrific progress, please don't slow down any time soon.