7 ms·
Coming from years of experience doing this with Waterfox - I would not recommend using anything like this. I used to be quite aggressive with compiler optimisa
by MrAlex94 3y ago
Coming from years of experience doing this with Waterfox - I would not recommend using anything like this.
I used to be quite aggressive with compiler optimisations - but all you are really doing is introducing instability and more often than not, performance regressions.
For the latest release, I actually started including polyhedral optimisation provided by the LLVM Polly project, but the effort resulted in essentially 0 performance gain. It was to be expected, as polly isn't really going to net general performance improvements, especially with the type of work a browser is doing.
It's also VERY easy to mislead yourself when adding these optimisations by getting a good run on a benchmark once or twice, yet you could try another run and get a different result. I am guilty of this myself, it took a long time to realise the mistakes I was making.
The reality was, I found, running on fresh device in comparison with Firefox, was almost no difference. The majority of performance improvements came from the engineering effort put in by Mozilla themselves and they are VERY good at that. The devs are also conscious of the available compiler optimisations and make a very good effort to include any that make a difference.
> Compiler optimizations include AVX, AES, LTO and PGO.
Firefox already does LTO and PGO, and for majority of the code, where AVX is beneficial, it is already included with code dispatch if the CPU supports it (for example with media codecs). The same goes for AES in the NSS library.
Does that mean you can't get Clang/LLVM to generate AVX instructions? Yes, I'm sure it does. Does it actually make a meaningful difference? No. Not that I've found from years of doing this and eventually just abandoning it.
The only time I ever saw big, proper gains from compiler optimisation alone was when I was compiling Waterfox with Intel's C++ compiler and using auto dispatching with the Qax [1] flag. Intel were doing some magic there. But the effort to get the Firefox codebase compiled with it was nothing short of sisyphean and essentially an exercise in masochism.
[1] https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-10/ax-qax.html https://www.intel.com/content/www/us/en/docs/cpp-compiler/de...