RobRich999 / Chromium_Clang

Chromium browser compiled with the Clang/LLVM compiler.
157 stars 10 forks source link

Building instruction for pgo #12

Closed philong6297 closed 3 years ago

philong6297 commented 3 years ago

Firstly i want to thank you for taking your time to build chromium binary with variant flags. Can you provide your instruction for building with pgo ? I dont really understand this build flag and i dont know how to make it works.

RobRich999 commented 3 years ago

https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization

Thankfully the Chromium project provides updated profiles to use. Grab the latest PGO profile like so:

vpython D:/depot_tools/chromium/src/tools/update_pgo_profiles.py --target=win64 update --gs-url-base=chromium-optimization-profiles/pgo_profiles

Change your drive and directories according to your local setup. ;) There are profiles available for the win32, win64, macos, and linux targets. I am not sure linux support is plumbed fully, yet, so YMMV there.

Once the above script is run, you can find the PGO profiles in chrome/build/pgo_profiles of your local Chromium repository:

D:\depot_tools\chromium\src\chrome\build\pgo_profiles

Add the profile to your args.gn build arguments and enable PGO like so:

chrome_pgo_phase = 2 pgo_data_path = "D:\depot_tools\chromium\src\chrome\build\pgo_profiles\chrome-win64-master-1599025789-3a109ab6fe2db36da4d9ead01eda119b5774b91d.profdata"

Profiles are updated often, so update the profile and build args with each new local build.