News for hackers. Stuff that matters.
Re:Chrome just got faster with Profile Guided Optimization by mintplant on Tuesday August 25, 2020 @01:02PM (#24273445)
Firefox has done this since forever. It's why official builds will generally be faster than compiling from scratch yourself. I'm surprised Chrome wasn't already taking advantage of PGO.
Re:Chrome just got faster with Profile Guided Optimization by cpeterso on Tuesday August 25, 2020 @04:30PM (#24275756)
Firefox started using PGO on Windows in Firefox in 2008 [1], Android last year [2], and macOS earlier this year [3]. Firefox uses PGO on Linux, but I don't remember when it was enabled.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=418865

[2] https://bugzilla.mozilla.org/show_bug.cgi?id=632954

[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1604578

Re:Chrome just got faster with Profile Guided Optimization by ignoramous on Tuesday August 25, 2020 @05:37PM (#24276452)
/offtopic

The all-new Firefox for Android (codename Daylight) is lightening fast, and perceptibly seems on-par with the Chrome for Android in terms of responsiveness.

What stumps me is Chrome for Android is 3.8MB whereas Firefox Daylight is upwards of 40MB.

Re:Chrome just got faster with Profile Guided Optimization by elisaado on Tuesday August 25, 2020 @05:41PM (#24276501)
Chrome's engine is built into Android, whereas the engine Firefox uses is not and thus has to be shipped with it.
Re:Chrome just got faster with Profile Guided Optimization by agi0 on Tuesday August 25, 2020 @10:59PM (#24278637)
I haven't looked at what Google does recently but you're likely getting most of Chrome in a separate package (e.g. the system WebView). Chrome and Firefox are of compareble size IIRC (56MB vs 65MB)
Re:Chrome just got faster with Profile Guided Optimization by avasthe on Wednesday August 26, 2020 @04:09AM (#24280271)
What's sad is they only support very few selected Add Ons.
Re:Chrome just got faster with Profile Guided Optimization by outworlder on Tuesday August 25, 2020 @06:20PM (#24276915)
Not sure if they will keep this edge given all the loss of talent.
Re:Chrome just got faster with Profile Guided Optimization by Klathmon on Tuesday August 25, 2020 @02:05PM (#24274135)
>It's why official builds will generally be faster than compiling from scratch yourself.

Would it be possible for Google to publish the profile data along with the source code to enable those who compile from scratch to have these same optimizations?

>I'm surprised Chrome wasn't already taking advantage of PGO.

They have been on windows since M53 (released in 2016), but this seems to be a better implementation and it's now for MacOS as well now.

Re:Chrome just got faster with Profile Guided Optimization by jeffbee on Tuesday August 25, 2020 @03:42PM (#24275206)
> Would it be possible for Google to publish the profile data

They do.

https://chromium.googlesource.com/chromium/src.git/+/master/...

Re:Chrome just got faster with Profile Guided Optimization by CalChris on Tuesday August 25, 2020 @03:13PM (#24274888)
Can you explain this because the article says:

  It is rolling out with Chrome M85 on Mac and Windows.
Never mind. This [1] says:

  Starting in Chrome 53, Chrome has started using
  Microsoft’s Profile Guided Optimization (PGO)
  technology to make Chrome up to 15% faster
  on Windows.
This strongly implies Google was using MSVC for the M53 build.

[1] https://blog.chromium.org/2016/10/making-chrome-on-windows-f...

Re:Chrome just got faster with Profile Guided Optimization by 1f60c on Tuesday August 25, 2020 @03:18PM (#24274962)
From the article: "PGO was initially introduced in M53 for Chrome on Windows using Microsoft Visual C++ (MSVC) […] In M85, we are rolling out PGO on Mac and Windows using Clang."

So it sounds like they've been using PGO for a while using MSVC, and now they've started using PGO with Clang.

Re:Chrome just got faster with Profile Guided Optimization by jcelerier on Wednesday August 26, 2020 @02:50AM (#24279850)
Wouldn't PGO only work with the exact source code, flags, compiler version, etc... used by google ? At which point you'll end up with the exact same binary than Google's too
Re:Chrome just got faster with Profile Guided Optimization by loeg on Tuesday August 25, 2020 @02:18PM (#24274293)
Is M85 the first Chrome Windows release done with Clang, as opposed to MSVC? I haven't been following the Windows side of it.
Re:Chrome just got faster with Profile Guided Optimization by Ziggy_Zaggy on Tuesday August 25, 2020 @04:26PM (#24275717)
Great question! Anyone have this answer?
Re:Chrome just got faster with Profile Guided Optimization by zmodem on Tuesday August 25, 2020 @04:34PM (#24275792)
Chrome M64 was the first shipping version built with Clang on Windows: http://web.archive.org/web/20200125010517/http://blog.llvm.o...
Re:Chrome just got faster with Profile Guided Optimization by loeg on Wednesday August 26, 2020 @01:28PM (#24284809)
Thanks. So Chrome on Windows had MSVC PGO from 53-63, but lost PGO from 64-84.
Re:Chrome just got faster with Profile Guided Optimization by 3pt14159 on Tuesday August 25, 2020 @01:54PM (#24274016)
I'm surprised that there isn't a way to do PGO when compiling from scratch. A way of telling the compiler exactly what parts are, but build it into the codebase so that one could get the best of both worlds.
Re:Chrome just got faster with Profile Guided Optimization by mintplant on Tuesday August 25, 2020 @01:56PM (#24274039)
You can pass a PGO flag to the build system [0], but IIRC from when I was there last, Mozilla puts some serious machine hours into PGO cycles for each release and that isn't easy to replicate as an individual developer. The profiling captures things which are very specific to the actual build being optimized, so inlining that information into the codebase wouldn't be so helpful. Though there are already static optimization hints spread throughout the code (off the top of my head, MOZ_LIKELY/MOZ_UNLIKELY for marking conditionals).

[0] https://firefox-source-docs.mozilla.org/build/buildsystem/pg...

Re:Chrome just got faster with Profile Guided Optimization by loeg on Tuesday August 25, 2020 @02:20PM (#24274314)
Mozilla could publish their profile data for a given release image.
Re:Chrome just got faster with Profile Guided Optimization by glandium on Tuesday August 25, 2020 @07:36PM (#24277514)
They are public, but you have to know where to look. I do think they should be published alongside the builds on archive.mozilla.org. (disclaimer: I work for Mozilla)
Re:Chrome just got faster with Profile Guided Optimization by CalChris on Tuesday August 25, 2020 @04:34PM (#24275786)
Given PGO and branch prediction, has anyone tested whether turning off MOZ_LIKELY/MOZ_UNLIKELY makes any difference?
Re:Chrome just got faster with Profile Guided Optimization by wyldfire on Tuesday August 25, 2020 @02:25PM (#24274373)
PGO guides inlining and branch prediction IIRC. You can give static hints about each of these. But the hints aren't on a continuum like they are with PGO. So finding an optimal balance for these will be harder. Also you have to maintain these hints. So if you were somehow giving hints with a hotness ratio in the source it would be impossible to maintain and keep it accurate.
Re:Chrome just got faster with Profile Guided Optimization by brandmeyer on Tuesday August 25, 2020 @04:32PM (#24275767)
Also hot/cold partitioning. Keeping cold code code away from hot code can help L1I cache utilization, iTLB utilization, Operating system page-out, etc.
Re:Chrome just got faster with Profile Guided Optimization by 1f60c on Tuesday August 25, 2020 @03:17PM (#24274933)
This isn't the same, but some compilers have support for macros that tell it which branches are more likely to be taken than others, and in C++20, it's even a language feature.
Re:Chrome just got faster with Profile Guided Optimization by rurban on Tuesday August 25, 2020 @05:01PM (#24276060)
The G stands for guide. You need a testsuite to create a guided profile to optimize the branch hints.

Normally there's a simple make target, like chrome.pgo to create the initial binary chrome, run the testsuite with pgo or better autofdo via perf and from this create the optimized chrome.pgo. using Facebook's bolt is even better.

I have no idea about Google's byzantinian bazel tool. With make it's a simple target which automates these steps.

Re:Chrome just got faster with Profile Guided Optimization by loeg on Tuesday August 25, 2020 @02:19PM (#24274310)
If someone can give you the PGO profile data from the exact same compiler and sources, you can do -fprofile-use (PGO) on subsequent builds.
Re:Chrome just got faster with Profile Guided Optimization by rurban on Tuesday August 25, 2020 @05:03PM (#24276079)
Nowadays you are using perf profiles, and then use this with autofdo. The old -fprofile-use is not good enough and needs two steps.
Re:Chrome just got faster with Profile Guided Optimization by Lammy on Tuesday August 25, 2020 @03:58PM (#24275410)
I do PROFILE=on for my own www/firefox FreeBSD package builds too, but it does make it take twice as long. https://www.freshports.org/www/firefox
Re:Chrome just got faster with Profile Guided Optimization by cromwellian on Tuesday August 25, 2020 @09:52PM (#24278251)
Chrome's been doing it for a long time too, since version 53.
Re:Chrome just got faster with Profile Guided Optimization by crawsome on Tuesday August 25, 2020 @04:28PM (#24275736)
It's going to take a LOT of convincing to get me to use Chrome. I don't trust an ad company as my internet browser or phone OS anymore.
Re:Chrome just got faster with Profile Guided Optimization by vffhfhf on Tuesday August 25, 2020 @07:06PM (#24277305)
Not a glowing review of firefox lol.
Re:Chrome just got faster with Profile Guided Optimization by Scarbutt on Tuesday August 25, 2020 @02:06PM (#24274143)
And yet, Chrome has always feeled snappier and faster.
Re:Chrome just got faster with Profile Guided Optimization by michaelmrose on Tuesday August 25, 2020 @05:08PM (#24276124)
Chrome adopted multi core far sooner. A great if lengthy treatment here

https://yoric.github.io/post/why-did-mozilla-remove-xul-addo...