If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Announcement
Collapse
No announcement yet.
Fedora Looks To Build Firefox With Clang For Better Performance & Compilation Speed
Is the performance argument true? gcc vs clang benchmarks on phoronix tend to show gcc as leading in most aspects iirc.
Solus developer noticed minor improvements after switching to clang https://dev.getsol.us/T4966#128937
They are building Firefox with clang since 62 version.
how much of the code base of firefox is still C/C++ and how much is already written in rust? Of course this ratio would be more interesting for the performance/security critical stuff.
If in the (far far) future more code will be ported to/replaced by rust, does this change then really matter? Then the rust compiler should be the critical part or?
In the posted wayland bug report, I have seen that the linux binary provided by mozilla is build with –enable-rust-simd which is not used by my ubuntu 18.04 supplied version.
Simd should be really helpful for video acceleration, since we wont get handware acceleration anytime soon, so this sounds very helpful since video playback in browsers is still hugging bad for battery. Does someone maybe have more information which and where simd intrinsics are used in firefox?
I definitely will try some video playback with the ubuntu and mozila build version to see what causes more battery train.
how much of the code base of firefox is still C/C++ and how much is already written in rust? Of course this ratio would be more interesting for the performance/security critical stuff.
This wiki page gives an overview, but you'd have to get statistics by running e.g. tokei on a checkout of the source repository, though that may be somewhat inaccurate since WebRender recently moved in-tree and isn't used on release yet.
If in the (far far) future more code will be ported to/replaced by rust, does this change then really matter? Then the rust compiler should be the critical part or?
This is expected to matter in the future when e.g. cross-language ThinLTO becomes a thing. It doesn't make sense to base today's decision on which compiler to use on some hypothetical future though.
Does someone maybe have more information which and where simd intrinsics are used in firefox?
I don't know about the C/C++ parts, but regarding Rust code AFAIK the encoding_rs and regex crates currently use SIMD. dav1d will bring SIMD accelerated AV1 decoding.
Last edited by johnp117; 11 December 2018, 07:33 PM.
Is the performance argument true? gcc vs clang benchmarks on phoronix tend to show gcc as leading in most aspects iirc.
When Mozilla did the benchmarking, they compared the VERY old version of GCC 6 against the latest Clang+LLVM version 7, and no surprise, Clang+LLVM won. They had no real interest in comparing against GCC 8 since they had already decided to switch to supporting Clang+LLVM only for Firefox. GCC has all the optimizations Clang+LLVM has, including PGO and LTO.
That said, it's nothing wrong with Mozilla wanting to only support one toolchain in order to lessen their maintenance burden, but it says nothing about the current relative performance of GCC and Clang+LLVM.
The argument from mlau that llvm is also needed for rust is striking since this allows lto/inlining between rust and C/C++. So this switch very reasonable!
I did some quick benchmarks for testing the differences between the firefox linux binary provide by ubuntu (build with gcc 7.3) and mozilla (still build with gcc 6.4...):
so the mozilla binary build with the older gcc is nevertheless faster.
about:buildconfig shows the following noticeably differences: mozilla uses O3 instead of O2 and also defines MOZ_PGO=1 (profile guided optimization) and –enable-rust-simd
so maybe distros should also look more closely at the compile options.
Does someone know if the simd code paths can be selected at runtime or is this chosen at compile time?
They are probably doing this so they can simplify their life and only really target one or two compilers in their build system.
Unfortunately this is also how compiler specific quirks get in a codebase. It would be more responsible to at least test compiling with a number of different vendor compilers because they pick up different potential issues.
Why is it that the minute LLVM/CLang is mentioned in any post a bunch of nervous nellies have to chime in all concerned about why GCC was left out? In this case it is likely more about Rust, debugging support and other factors beyond performance that makes the changes reasonable to the Firefox team. Even then the delta between the two compiler chains is minor when running C++ code, with GCC's biggest wins being for features Firefox doesn't even use.
Why is it that the minute LLVM/CLang is mentioned in any post a bunch of nervous nellies have to chime in all concerned about why GCC was left out? In this case it is likely more about Rust, debugging support and other factors beyond performance that makes the changes reasonable to the Firefox team. Even then the delta between the two compiler chains is minor when running C++ code, with GCC's biggest wins being for features Firefox doesn't even use.
For the same reason they go on about why Qt was left out whenever someone mentions GTK, why flatpak was left out if someone mentions snap, etc.
Having said that, one of the reasons in this case is allegedly performance and since tests suggest that gcc seems to outperform clang in a majority of cases, it's undoubtedly a valid question. Other than that I agree with you; since they already use rust it only makes sense to move to clang.
Comment