Faster Linux builds

After two failed attempts last year, and a few glitches yesterday, we finally managed to get our Linux (and, obviously, Linux64) builds to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled. This means we are finally using a more modern toolchain, opening opportunities for things such as static analysis. This also means we are now producing a faster Firefox, now much closer to the Windows builds on the same hardware on various performance tests.

A nice side effect of some of the work I have done to make the switch possible is that these builds will also work on older Linux platforms such as RedHat/CentOS 5, or possibly older (as long as they come with libstdc++ from GCC 4.1).

The first Firefox release to benefit these new settings should be Firefox 6.

A few branches other than mozilla-central have also been switched, most notably Try, for which there is a known issue if you push something too old. Please make sure to read the corresponding information on wiki.m.o for a workaround. A Mercurial hook is going to be put in place to issue a warning if there are chances your build will fail (it will, however, not prevent the push).

Thanks to Chris Atlee, Rail Aliiev, Taras Glek, Justin Lebar and all those I forgot or am not aware of for their assistance and/or past involvement in the previous attempts.

2011-04-29 11:31:18+0200

p.m.o

You can leave a response, or trackback from your own site.

60 Responses to “Faster Linux builds”

  1. CCG Says:

    Why GCC 4.5 and not 4.6?

    http://gcc.gnu.org/gcc-4.6/

  2. dominik Says:

    Awesome! Do you have any idea if these optimizations will be easy to implement in packages provided by various distributions?

  3. Z.T. Says:

    @CCG: I guess: Too many regressions in 4.6. When it can build firefox with LTO and PGO with -g (for example: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48207) then they’ll upgrade. Have you tried rebuilding your entire distro with gcc 4.6?

  4. J Says:

    > with aggressive optimization (-O3)

    This is a bad, bad idea. -O3 should only be applied to code that will benefit from it the most (see GCC documentation) – otherwise it just induces bloat that makes the program SLOWER.

    Big apps like Firefox benefit a LOT more from -Os, since they can more easily fit into the processor’s cache then.

  5. lefty.crupps Says:

    Firefox 4.0.1 just came out today, why must we wait until Firefox 6.x?? Lets make 4.5.2 the next release, the 0.0.2 being the minor upgrade, and the 0.5.0 being this major compile improvement.

  6. Zack Says:

    -O3 should only be applied to code that will benefit from it the most (see GCC documentation) – otherwise it just induces bloat that makes the program SLOWER.

    This is true without profile-guided optimization, but one of the things PGO does is back down from -O3 to -Os for cold code. We wouldn’t be making this change without performance numbers to back it up; we see across-the-board improvements of at least 5%, 20% on some benchmarks (I don’t have links, but maybe Mike does).

  7. azakai Says:

    > Firefox 4.0.1 just came out today, why must we wait until Firefox 6.x??

    This can’t be shipped as part of a stable release without a lot of testing. There are lots of potential issues that it can cause, that aren’t immediately apparent.

    But, you can try Firefox 6 right now! If you run Nightly, then that is the code that will eventually ship as Firefox 6. Or, wait a few weeks and it will be available as Aurora, which is a little more stable. (And 6 weeks later, as Beta.)

    Nightly and Aurora builds are *exactly* meant for this situation – when you want to benefit from a cool new feature like GCC 4.5/-O3/PGO – without waiting for all the testing to be done, and are ok with something not as stable as a fully tested release.

  8. Firefox 6 For Linux To Be As Fast As Firefox Currently Is On Windows (And Less Sluggish) Says:

    [...] Source Free subscription: Subscribe RSS feed or get daily tips in your email Jump to Comments ↓ * Click confirmation link sent in email * Don't see the email? check spam folder [...]

  9. Firefox gets faster on Linux | ayamrocker by john hawk Says:

    [...] and today a group of Mozilla developers has repaid their devotion with some good news. Mozilla’s Mike Hommey reported this morning that his team of coders finally managed to get both 32 and 64-bit Firefox builds for Linux to [...]

  10. moof Says:

    I’m guessing this is x86/amd64 only?

  11. Justin L. Says:

    > I’m guessing this is x86/amd64 only?

    Android is still building with -Os, I think primarily to keep the binary size down, but perhaps also because we use an older compiler there. I’m not sure about Maemo or other ARM platforms, but it’s all in configure.in if you can find it. :)

    http://hg.mozilla.org/mozilla-central/file/068d876996c6/configure.in#l2693

  12. Tobu Says:

    Wow that’s lovely. The GCC 4.6 release notes mention building firefox with LTO, but I guess that still needs polishing?

  13. Firefox 6 บนลินุกซ์จะเร็วขึ้นเพราะเปลี่ยนคอมไพเลอร์ | Content Store Says:

    [...] – Mike Hommey, [...]

  14. Adrian Says:

    Well I looked at perf-o-matic, and the improvements are enormous. For example a year’s worth of speed up in page load, Wow just wow.

    for 32 bit
    Ts -8.4%
    Tp4 -11.6% This one is so good it needs a link:

    http://graphs.allizom.org/graph.html#tests=38,1,14&sel=none&displayrange=7&datatype=running

    Txul -10.0%
    DHTML -1.0%

    for 64 bit
    Ts -5.0%
    Tp4 -6%
    Txul -5.5%
    DHTML -0.9%

  15. Firefox 6 บนลินุกซ์จะเร็วขึ้นเพราะเปลี่ยนคอมไพเลอร์ « GrafPalio Blog Says:

    [...] - Mike Hommey, Digitizor Categories: Uncategorized LikeBe the first to like this post. [...]

  16. 好消息!Firefox 6的Linux版将和Windows版一样快_Ubuntu新闻资讯 | UbuntuSoft Says:

    [...] Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  17. Firefox для Linux станет таким же быстрым, как и для Windows | AllUNIX.ru – Всероссийский портал о UNIX-системах Says:

    [...] проекта Mozilla и мэйнтейнер пакета Iceweasel в Debian GNU/Linux, объявил о готовности к переходу при формировании 32- и [...]

  18. Jan Hubicka Says:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48207 is only about compiling with link time optimization. I am building mozilla with GCC 4.6 and current GCC mainline quite regularly and it seems to just work. Did not do any serious testing.

    Also -O2 and -O3 is pretty much same with PDO. Inlining and other stuff is implied by -fprofile-use.

    It could be nice to analyze where GCC still lacks compared to Windows build se we can do something about it in 4.7 ;) (and of course watch Mozilla performance with mainline GCC so we don’t have any stupid regressions)

  19. Jan Hubicka Says:

    Also note that the link time optimization issues are tracked here http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45375.
    To make story short, GCC 4.6. builds working mozilla with LTO and binary is a lot smaller. There are however problems with debug info and fact that it needs 8GB of memory.

    Mainline GCC is getting better on memory usage and hopefully will hammer out the debug info issues. Still however it won’t build with -g and LTO, yet.

  20. KK Says:

    Here is a Dromaeo ff4->ff6 before-after: http://dromaeo.com/?id=139110,139113

    One test became slower (bitwise and), and a few show big improvements. Though I don’t know which tests call into C code, are intepreted javascript, or are jit-ed javascript.

  21. KK Says:

    (ff6 is the latest firefox 6a1 nightly, and the results are very noisy, though Dromaeo uses statistics to compensate. Also this was not a clean profile.)

  22. Firefox 6 sarà molto più veloce, specialmente su Linux - Chimera Revo Says:

    [...] Hommey, membro di Mozilla, ha annunciato tramite il suo blog che dopo ben due tentativi falliti, si è riuscito ad ottenere un incremento delle prestazioni [...]

  23. Linux-versie Firefox 6 moet net zo snel worden als Windows-versie » Clippy.be Says:

    [...] Mike Hommey laat op zijn weblog weten dat zij bij de ontwikkeling van de laatste Linux-testbuilds er in zijn geslaagd om de GCC [...]

  24. Firefox для Linux станет таким же быстрым, как и для Windows Says:

    [...] проекта Mozilla и мэйнтейнер пакета Iceweasel в Debian GNU/Linux, объявил о готовности к переходу при формировании 32- и [...]

  25. Linux版Firefox 6将和Windows版一样快 | laura's site Says:

    [...] Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  26. Linux-versie Firefox 6 moet net zo snel worden als Windows-versie | Webtechnologie Says:

    [...] Mike Hommey laat op zijn weblog weten dat zij bij de ontwikkeling van de laatste Linux-testbuilds er in zijn geslaagd om de GCC [...]

  27. gouchout Says:

    Are the 6.0a1 Nightlies being built now with the new toolchain? I got the impression that was the case.

  28. Tame Says:

    Do you know if the various distro will automatically pick up those changes as well when FF6 comes out (Not trying to troll or anything, I’m genuinely curious, I don’t know how much their build configuration differs from mozilla’s) ? Are there any plans in place to help them transition their FF packages to this new toolchain ?

  29. Firefox si prepara a correre forte su Linux - The New Blog Times Says:

    [...] parole stesse di Hommey: “Dopo due tentativi falliti dello scorso anno e dopo qualche rognetta di ieri, [...]

  30. Anthony Shipman Says:

    I’ve noticed that the JPEG decoding code, e.g. jidctint.c
    has SSE2 optimisations for Windows and MacOS. It seems to me there is a performance problem when scrolling pages of JPEGs.
    Is there any chance of getting SSE2 optimisations for Linux?

  31. OpenSource News » Firefox su Linux passa a GCC 4.5 e diventa più veloce Says:

    [...] due tentativi falliti (lo scorso anno), gli sviluppatori sono riusciti a compilare una versione Linux di Firefox con GCC 4.5, attivando il livello di ottimizzazione più aggressivo (-O3) e la profile guided optimization [...]

  32. _u_ Browsing the web in the right way › Wireless Sensor Network and More Says:

    [...] 6将和Windows版一样快。 Mozilla的Mike Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  33. myPost.gr | Ο Firefox 6 για Linux θα είναι τόσο γρήγορος όσο και στα Windows Says:

    [...] έκδοση του προγράμματος στα Windows. Σύμφωνα με δημοσίευμα που προέρχεται από προγραμματιστή της Mozilla, η ομάδα [...]

  34. Firefox 6 – Prestazioni nettamente superiori grazie a GCC 4.5 « Ubuntu Secrets Says:

    [...] puntualizza lo stesso sviluppatore, la prima release a beneficiare del cambiamento (si parla di incrementi prestazionali tra il 5 e il [...]

  35. Coming Soon: A Faster Firefox for Linux Users « Breaking News « Theory Report Says:

    [...] to use GCC 4.5, with assertive optimization (-O3) and form guided optimization enabled,” wrote developer Mike Hommey on [...]

  36. Linux版Firefox 6将和Windows版一样快 | IMDevice Says:

    [...] Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  37. Mozilla Set to Improve Firefox for Linux | ayamrocker by john hawk Says:

    [...] optimization (-O3) and profile guided optimization enabled,” Mozilla developer Mike Hommey blogged. “This means we are finally using a more modern toolchain, opening opportunities for things [...]

  38. Linux版Firefox 6将和Windows版一样快 | 数码港 Says:

    [...] Hommey在博客上宣布, 他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  39. Linux版Firefox 6将和Windows版一样快 – 亿客网络 Says:

    [...] Hommey在博客上宣布, 他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  40. Coming Soon: A Faster Firefox for Linux Users (PC World) - Software News | Software News Says:

    [...] to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled,” wrote developer Mike Hommey on [...]

  41. ¿Por qué Firefox es más lento en Linux que en Windows? Says:

    [...] palabra de Mike Hommey, desarrollador de Mozilla: Por fin nos las hemos arreglado para conseguir que nuestras versiones [...]

  42. Coming Soon: A Faster Firefox for Linux Users « news4geeks.net Says:

    [...] builds to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled," wrote developer Mike Hommey on [...]

  43. Coming Soon: A Faster Firefox for Linux Users « news4geeks.net Says:

    [...] builds to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled," wrote developer Mike Hommey on [...]

  44. MB Consulting - Firefox 6 for Linux will be more optimized MB Consulting Says:

    [...] see here [...]

  45. Coming Soon: A Faster Firefox for Linux Users (PC World) | HP EX490 Says:

    [...] to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled,” wrote developer Mike Hommey on [...]

  46. Ted Mielczarek Says:

    > I’m guessing this is x86/amd64 only?

    Well, in that we don’t have desktop Firefox builds for ARM, yes. We could theoretically build our Android/Maemo builds with PGO, but it’s not as simple as the desktop case, since a) the profiling run has to be on a device, which makes it more complicated, and b) the toolchains are more of a pain to deal with, since they’re usually customized.

  47. Coming Soon: A Faster Firefox for Linux Users (PC World) | DeLonghi BAR32 Says:

    [...] to use GCC 4.5, with aggressive optimization (-O3) and profile guided optimization enabled,” wrote developer Mike Hommey on [...]

  48. Mozilla To Launch Faster Firefox For Linux Users | ayamrocker by john hawk Says:

    [...] The team was successful in compiling the web browser with GCC after two failed attempts last year, Mozilla developer Mike Hommey informed via blog post. [...]

  49. Linux版Firefox 6将和Windows版一样快 | Article2Net Says:

    [...] Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

  50. בקרוב: פיירפוקס מהיר יותר ללינוקס | הקובץ Says:

    [...] אגרסיבית (-O3) וכן אופטימיזציה מונחית פרופיל פעילות", כך כתב המפתח מייק הומי ביום שישי האחרון, "זאת אומרת שאנחנו [...]

  51. Firefox bientôt davantage optimisé pour Linux | Allomonsite.com Says:

    [...] Mike Hommey, member au développement du navigateur Firefox au sein de l’équipe de Mozilla, annonce en effet avoir finalement réussi à compiler une build de l’application avec le compilateur [...]

  52. Más velocidad para Firefox en equipos Linux | Geekets Says:

    [...] de referencia: Glandium. – Publicidad [...]

  53. En vrac’ divers et (a)variés ;) | Le Weblog de Frederic Bezies Says:

    [...] Mozilla Firefox bientôt plus rapide sous linux ? Ce serait pas un mal… Mais le plus intéressant, c’est le moteur Javascript et dont la nouvelle génération s’appellera IonMonkey. Qui ne sera pas disponible avant Mozilla Firefox 6, à mon très humble avis d’utilisateur des logiciels de la Fondation Mozilla depuis… 11 ans environ [...]

  54. ¿Por qué Firefox es más lento en Linux que en Windows? « Conocimiento Libre (o lo que está detrás del Software Libre) Says:

    [...] palabra de Mike Hommey, desarrollador de Mozilla: Por fin nos las hemos arreglado para conseguir que nuestras versiones [...]

  55. Firefox bientôt davantage optimisé pour Linux | Global-SSII Says:

    [...] Hommey, participant au développement du navigateur Firefox au sein de l’équipe de Mozilla, annonce en effet avoir finalement réussi à compiler une build de l’application avec le compilateur [...]

  56. SimplyMEPIS 11 adds LibreOffice and a faster Firefox 4 | atefekyvusy Says:

    [...] distro also features FireFox 4.01, which is claimed to run much faster on Linux than it did previously. The Mozilla team announced in late April it had finally managed to [...]

  57. Firefox 6 ist da! | HalloUbuntu Says:

    [...] lässt sich auf das Wechseln des Compilers auf GCC 4.5 zurückführen. Der Firefox-Entwickler Mike Hommey schreibt dazu: After two failed attempts last year, and a few glitches yesterday, we finally managed to get [...]

  58. Firefox 6 in finaler Version erschienen Says:

    [...] und mit aktivierter “profile guided optimization”, wie die Entwickler bereits im April in einem Blog-Eintrag verrieten. Nebeneffekt: Firefox 6 sollte nun auch auf älteren Linux-Plattformen, wie [...]

  59. Was ist neu an Firefox 6? | Linux und Ich Says:

    [...] Compiler umzusteigen, doch erst mit Firefox 6 ist dies nun gelungen. Mozilla-Entwickler Mike Hommey schreibt in seinem Blog: We finally managed to get our Linux (and, obviously, Linux64) builds to use GCC 4.5, with [...]

  60. 好消息!Firefox 6的Linux版将和Windows版一样快 | ubuntu 啦 Says:

    [...] Hommey在博客上宣布,他的团队成功利用整合配置文件导引优化(Profile-Guided [...]

Leave a Reply