Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Disable LTO in builds of CanvasKit to reduce binary size #40733

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

jason-simmons
Copy link
Member

No description provided.

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -15,6 +15,9 @@ wasm_toolchain("canvaskit") {
skia_use_libjpeg_turbo_decode = true
skia_use_libpng_decode = true
skia_use_libwebp_decode = true

# Disable LTO.
enable_lto = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to be the same for all CanvasKit builds, you can also add it to tools/gn. But this is good too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding it to tools/gn would conflict with skwasm, which must always be built with LTO enabled

Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kevmoo
Copy link
Contributor

kevmoo commented Mar 29, 2023

@jason-simmons – we're are super confident that

  1. this is a solid size win (how much?)
  2. there are ~zero perf regressions?

@jason-simmons
Copy link
Member Author

After disabling LTO I saw a 13% reduction in the size of canvaskit.wasm in my local wasm_release build. I did not notice significant performance differences in local runs of web_benchmarks_canvaskit when disabling LTO.

I can wait a day before landing this PR in order to get more runs of the benchmarks on the Skia dashboard with -O3 and LTO. After that we can check if the dashboard reports any change from disabling LTO.

@jason-simmons
Copy link
Member Author

Also, the builds of CanvasKit that we had previously obtained from Skia were not built with LTO.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants