Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling Chrome/Chromium with performance considerations

I am currently weighing the potential pros and cons of running local builds of Chromium.

I have never built Chromium from source before, but I understand it is a huge project and the compilation requirements are hefty and time-consuming.

I have dabbled with the idea before, but for reasons centered around performance. In specific:

  • Could Chromium benefit much from Profile Guided Optimization?
  • Could building Chromium with GCC native CPU optimizations provide more than a marginal performance benefit over using the generic binary builds? (Specifically with the Haswell and Broadwell archs)
  • Is there anything else that can be done to improve overall performance or memory efficiency when building Chromium locally?

After a bit of research back then, I ended up coming to the conclusion that this was not going to be worth the effort.

I do remember running PGO builds of Firefox some years ago, and Firefox does still seem to offer decent support for running PGO builds. However, in the case of Chromium, it appears to be a lot more complicated.

Chromium does seem to have some native support for PGO builds. Unfortunately, that support looks to be entirely Windows specific. PGO builds for other operating systems are not supported, and with all of Chromiums unique build complexities, it did not seem worth the effort to attempt a PGO build without this aid.

If anyone else knows of someone that has successfully attempted this on Linux, I would be very interested to see the results.

In regards to GCC CPU optimizations, my understanding is that the benefits provided here are almost always marginal, but with how complex Chromium is, it does seem plausible that it could benefit more from this more than most applications.

It is still probably not worth the effort for just GCC optimizations, but the reason I am considering doing this again is so that I can also take advantage of a patch to enable VA-API: https://aur.archlinux.org/packages/chromium-vaapi/

Finally gaining support for hardware accelerated video decoding could be worth the effort here. Now what I am curious about is what the performance considerations are when doing this.

tl;dr

  • Can I expect any perceptible difference in performance when using a build of Chromium compiled locally with native CPU optimizations?
  • Is PGO with Chromium feasible on Linux, and if so, what are the best ways to do the actual profiling?
like image 502
Josh H. Avatar asked Nov 08 '22 07:11

Josh H.


1 Answers

FWIW, I run Gentoo Linux, meaning everything on my system is compiled from source. I have alternated between building chromium from source, with custom cflags, and using the binary google-chrome-stable package which is also available. I do notice a performance improvement running locally compiled chromium vs. the pre-packaged binary of Google Chrome.

Now, whether that is a result of compiler optimizations, or differences between the version of Google Chrome and Chromium (at the moment they are pretty near each other - Google Chrome 55.0.2883.87 and Chromium 55.0.2883.75), I cannot say. But the improvement was enough that I'll went back to Chromium and will probably stay with it a while.

The downside of building it from source (particularly if updating packages on your OS means rebuilding it) is that it revs frequently, and building it takes close to two hours on an i7 8Gb laptop with SSD. So it turns most system updates into a long, slow process - which is why I had switched to binary builds a year or two ago.

like image 146
Tim Boudreau Avatar answered Nov 15 '22 07:11

Tim Boudreau