better build times through configury

There’s been a flurry of activity lately on making Firefox build faster.  One thing that’s not talked about much is tailoring what features how build or how you build can make things go faster.  Below are a couple configure options that may make your life better, depending on what platform you develop for and what your focus is.  None of these are going to help as much as glandium’s xulrunner SDK development trickery, but for those who can’t do that, for whatever reason, these may be helpful.  Add them to your mozconfig with ac_add_option or your manual configure invocation if you are oldschool.

  • --disable-debug-symbols: This option isn’t appropriate if you plan on doing any C/C++ debugging. Really. But if you work more-or-less exclusively in JavaScript (or Java, for Android), this option can make your builds go much faster by making your object files smaller and link times faster. My local Android builds shave 30 minutes of total runtime (!) by enabling this. The actual win is somewhere on the order of 3 minutes due to the wonders of parallel make. Still, 15% improvements are nothing to sneeze at.
  • --disable-crashreporter: This configure option builds less code, which is always a good thing.  Needing the crashreporter would be pretty unusual for local development, so this is probably pretty safe.
  • --disable-webrtc: Again, ths option is for not building a (somewhat larger) swath of code.  May not be appropriate if you’re doing Web Audio or trying to measure startup improvements.
  • --disable-icf: This option is only useful if you’re building on Linux and you know you’re using the gold linker.  This option turns off merging of identical functions, which makes the linker run slightly faster.  (May also work on Windows with opt builds, not sure.)

For development on Linux with GCC specifically, there are a few compiler options that may make your life better also:

  • -fno-var-tracking: This option makes the debug information for C/C++ slightly less accurate.  Variable tracking is a relatively new thing (GCC 4.6+) and tends to suck up quite a bit of compile time.  If you were debugging happily with GCC 4.5 and earlier, you may not notice any problems with turning variable tracking off.
  • -gsplit-dwarf: What this does is it separates debug information into a completely different file from the actual compiled code.  This change, in turn, makes the object files smaller, primarily for the benefit of the linker.  You can read more about the motivation for splitting debug information into separate files on the GCC Wiki.  There’s also a bug about adding this by default to local developer builds.  (Recent SVN builds of clang also support this option, I think.)

Finally, if you want to dive really deep, you can play around with the options passed to the gold linker on Linux.  (And if you do, please post some numbers to that bug; we’d love to get more data on how those options work for people!)

4 comments

  1. “–disable-tests” also reduces build time if you don’t need tests.

    Skipping the installation files (e.g. the .msi etc on windows) might also improve time, but I can’t see such option at https://developer.mozilla.org/en/docs/Configuring_Build_Options

  2. After setting –disabe-debug-symbols, –disable-update-packaging (both were explicitly enabled before at my .mozconfig) and adding –disable-crashreporter (had no explicit directive before), and keeping –disable-webrtc, –enable-optimize and –disable-tests, my clobber build on windows went down from 38 mins to 26. That’s a whopping 30%+ reduction in build time. w00t! \o/

    Obviously, if one needs to single step c++, work on tests, etc, the relevant directives should be set.

    FWIW, this is my current .mozconfig:

    #avih – not sure how much disable update packaging helps, but I don’t think I need it.
    #ac_add_options –enable-update-packaging
    ac_add_options –disable-update-packaging

    ac_add_options –enable-jemalloc
    ac_add_options –enable-signmar
    ac_add_options –enable-profiling

    # Nightlies only since this has a cost in performance
    ac_add_options –enable-js-diagnostics

    # Needed to enable breakpad in application.ini
    export MOZILLA_OFFICIAL=1
    export MOZ_TELEMETRY_REPORTING=1

    # Package js shell.
    #avih – orig: export MOZ_PACKAGE_JSSHELL=1
    export MOZ_PACKAGE_JSSHELL=0

    #. “$topsrcdir/build/mozconfig.common.override”

    #avih – disable webrtc and crash-reporter for faster build times
    ac_add_options –disable-webrtc
    ac_add_options –disable-crashreporter

    #avih – For debugging c++, must have debug symbols (slower build), and disable-optimize many times help in single step, but results in slower runtime.

    #ac_add_options –enable-debug-symbols
    ac_add_options –disable-debug-symbols

    #ac_add_options –disable-optimize
    ac_add_options –enable-optimize

    #avih – disable tests for faster build, but needs rebuild if want tests
    ac_add_options –disable-tests

    mk_add_options AUTOCLOBBER=1

  3. Note that, historically, having configure options like these isn’t really supported. Don’t be surprised if your builds start breaking. But in the mean time, yay faster builds!