8 ms·
Firefox switching to clang-cl for Windows builds
- glymor 8y agoA reply in the thread from David Major about performance: "At the moment, performance is a mixed bag. Some tests are up and some are down. In particular I believe Speedometer is down a few percent." "Note however that clang-cl is punching above its weight. These builds currently have neither LTO nor PGO, while our MSVC builds use both of those. Any regressions that we're seeing ought to be short-lived. Once we enable LTO[1] and PGO[2], I expect clang to be a clear performance win." [1] "LTO (Link Time Optimization) is a method for achieving better runtime performance through whole-program analysis and cross-module optimization." http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html http://blog.llvm.org/2016/06/thinlto-scalable-and-incrementa... [2] PGO = Profile Guided Optimization
- kjeetgill 8y agoInteresting. Do they collect profiles from Nightly users or do they have some internal characteristic workload?
- gsnedders 8y agoIt's based on the perf tests, which I think are all public.
- krasin 8y agoLTO can be particularly handy when doing devirtualization. Our experience ([1]) with Chromium demonstrated that there's a fair amount of virtual methods which have exactly two implementation in the code: one for production and another one for tests. While linking production code, it's trivial for this optimization to spot that, replace a virtual call with regular invocation and then often inline and allow for other in-place optimizations. In many cases of the renderer (Blink), that gives 3%-7% speedup out of nowhere. 1. https://bugs.chromium.org/p/chromium/issues/detail?id=580389#c25 https://bugs.chromium.org/p/chromium/issues/detail?id=580389...
- simcop2387 8y agoThat's really cool. I've primarily seen LTO benefits on the more embedded side of things where it ends up enabling far more aggressive dead code elimination between code and libraries which makes it much easier to fit into small chips. I hadn't thought much about virtual methods with C++ code (uncommon to see those in embedded code to begin with).
- mehrdadn 8y agoOut of curiosity, why use virtual calls in those cases? Why not just have two different implementation files -- one for tests, and one for production -- and choose one based on which one you're doing? It seems like a win all around.
- fulafel 8y agoThere's always performance hacks to be found in big apps, in exchange for implementation complexity and man-hours. And there's always a next bottleneck to be found. Performnace bugs are subject to an extended form of survivorship bias where they become bigger when the preceding perf bottlenecks get fixed.
- mehrdadn 8y agoI've refreshed and seen three major revisions of your comment after writing a full reply to the first one, and I can't say I've been able to clearly follow where you're coming from and where you're going with any of them. I would suggest that if you feel the need for such drastic revisions, it may be worth reconsidering whether whatever you're trying to argue is really compelling.
- slededit 8y agoHis advice is sage and you should look past whatever deficiencies you find in his form of communication. Simply put there's always bigger fish to fry, and virtual methods are a quick and easy way to implement test stubs. Especially when the compiler devirtualizes.
- kibwen 8y ago> Watch for more toolchain changes to come. The next steps after this will be to switch to lld-link and enable ThinLTO. That will open the door to a cross-language LTO that could inline calls between Rust and C++. In the longer term we can look into cross-compiling from Linux. Very cool. The potential to inline Rust and C++ (and C, of course) code together at the LLVM level is one of those things that's been theoretically possible for a long time now but has yet to really mature in practice (at least, I'm not aware of anyone aside from Mozilla attempting it at scale). Really curious to see how this affects Firefox performance once they get it all wired up.
- timClicks 8y agoRust's performance benefits won't be immediate, as single-threaded C++ is already very fast and safe parallelism benefits of Rust would be difficult (impossible?) to leverage across language boundaries. I'm more interested in seeing whether the maintainability of Firefox will increase over time as the proportion of Rust code increases. That is, will Mozilla be able to accelerate Firefox's development because the source code is in a safer language?
- agumonkey 8y agoI'm trying firefox nightly these days and I notice my cpu has burning peaks (60 -> 80 C) I wonder if rust parallelism isn't kill my poor laptop heatsink/fan.
- rhelmer 8y agoHuh! I wouldn't expect that at all... here are some easy things to try: https://support.mozilla.org/en-US/kb/firefox-uses-too-many-cpu-resources-how-fix https://support.mozilla.org/en-US/kb/firefox-uses-too-many-c... If it is still happening after you try those, use https://perf-html.io/ https://perf-html.io/ and share a profile.
- dblohm7 8y agoAre you on a Mac by any chance?
- bluecalm 8y agoIt would be great if they switched to MinGW as well so both Clang and GCC work. MinGW needs some support as well and then they control the while toolchain. Sadly it probably doesn't make sense for them to allocate resources to that. On the other hand in my experience at least GCC dominates in performance department so that would help with not worrying about compiler switch causing performance regression.
- fithisux 8y agoI second that. clang-mingw could be another viable choice.
- bluecalm 8y agoIt would be great because then the builds would be independent of Microsoft VS infrastructure which is a total mess on Windows. Both Clang and GCC work with MinGW (I use MinGW64) headers so then you would have two modern open source compilers to cross-reference and open source toolchain you could fix or improve as needed.
- cpeterso 8y agoMozilla used to compile Firefox with mingw because Tor uses mingw, but here is the Firefox bug with about moving to clang-mingw: https://bugzilla.mozilla.org/show_bug.cgi?id=1465790 https://bugzilla.mozilla.org/show_bug.cgi?id=1465790
- dblohm7 8y agoI'm fine with being able to compile with mingw (and we already can on GCC), but we can't ship our release builds with it; it's too far behind the official Windows SDK in terms of supporting new platform features.
- bluecalm 8y agoYeah, I realize that supporting MinGW64 is a big task and probably not worth for one single player even as big as Mozilla. Still, I hope one day it gets picked up. Visual Studio dependency is painful and I think it will be quite a while till Clang catches GCC in performance department.
- electricwater 8y agoNo idea what is going on but interested in the commotion...
- yeukhon 8y agoWhy do i have to sign into Google in order to view this?
- tomhoward 8y agoI don't - it displays immediately for me when I load in a Firefox instance without a logged in Google account.
- bArray 8y agoIt's not about being signed into Google, it's about running JS.
- krick 8y agoIs it? JS in enabled, but I'm still required to login (both with or without uBlock running). Works in a Private Browsing Mode though.
- jwilk 8y agoIt's not the problem you're seeing, but the page does require JS: To use Google Groups Discussions, please enable JavaScript in your browser settings, and then refresh this page. NoScript users will be automatically redirected to this version (which doesn't require it): https://groups.google.com/forum/m/?_escaped_fragment_=topic/mozilla.dev.platform/wwO48xXFx0A https://groups.google.com/forum/m/?_escaped_fragment_=topic/...
- KwanEsq 8y agoAs an alternative here's Mozilla's archive view: https://lists.mozilla.org/pipermail/dev-platform/2018-July/022246.html https://lists.mozilla.org/pipermail/dev-platform/2018-July/0...
- andreyv 8y agoGoogle tries to make you log in if it knows you have an account. You can erase Google cookies to avoid that.
- simula67 8y agohttps://bugzilla.mozilla.org/show_bug.cgi?id=1443590 https://bugzilla.mozilla.org/show_bug.cgi?id=1443590 has info on why : > We've discussed this on several occasions but apparently nobody ever filed a bug. > There are a number of reasons using clang-cl for our official builds would be good: > * The ability to patch the toolchain as we do on other platforms > * The ability to diagnose and upstream fixes for compiler bugs we encounter > * It would provide motivation to switch to clang on all platforms, which would make it so we only have to worry about a single compiler for things like performance optimization (I don't assume we would drop support for MSVC or gcc, we just wouldn't have to worry as much about compiler quirks)
- deleted 8y ago[deleted]
- stuartd 8y agoToday's Nightly build about:buildconfig Compiler Version Compiler flags z:/build/build/src/clang/bin/clang-cl.exe -Xclang -std=gnu99 -fms-compatibility-version=19.13.26128 19.13.26128 -Qunused-arguments -nologo -wd4091 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -Gw -wd4244 -wd4267 -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-deprecated-declarations -Wno-invalid-noreturn -we4553 z:/build/build/src/clang/bin/clang-cl.exe -fms-compatibility-version=19.13.26128 19.13.26128 -Qunused-arguments -Qunused-arguments -TP -nologo -w15038 -wd5026 -wd5027 -Zc:sizedDealloc- -wd4091 -wd4577 -D_HAS_EXCEPTIONS=0 -W3 -Gy -Zc:inline -Gw -wd4251 -wd4244 -wd4267 -wd4800 -wd4595 -wd4065 -Wno-inline-new-delete -Wno-invalid-offsetof -Wno-microsoft-enum-value -Wno-microsoft-include -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-deprecated-declarations -Wno-invalid-noreturn -Wno-inconsistent-missing-override -Wno-implicit-exception-spec-mismatch -Wno-unused-local-typedef -Wno-ignored-attributes -Wno-used-but-marked-unused -we4553 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -GR- -Zi -O2 -Oy-
- teddyh 8y agoNote that they're switching from MSVC to clang-cl. Since the headline doesn't mention MSVC, this could be interpreted as relevant to the old GCC vs. Clang issue, but it really isn't in this case.
- sohkamyung 8y agoThe headline does say for Windows builds. Would that imply MSVC being the original compiler being used, since that is the usual default compiler under Windows?
- gregwtmtno 8y agoThis is in the latest nightly. Open "about:buildconfig" to see if you're using it.