Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[single-exe] Enable LTO when building corebundle #26697

Merged
merged 1 commit into from Sep 18, 2019

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Sep 13, 2019

Using the link-a-thon app, this drops about 25-30ms in total startup (startup + first request) and 0.35MB in the bundled app size.

Without LTO (28.91 MB app):

RPS CPU (%) Memory (MB) Avg. Latency (ms) Startup (ms) First Request (ms) Latency (ms)
136,851 97 169 2.48 228.8263 127.9611 0.7535
140,516 98 169 1.99 228.9596 128.6934 0.9584
136,038 96 169 2.27 227.5574 125.7193 0.8264
137,672 98 169 2.04 218.0485 124.9019 0.5842
137,626 95 170 2.1 223.1652 131.0142 0.9527

With LTO (28.56 MB app):

RPS CPU (%) Memory (MB) Avg. Latency (ms) Startup (ms) First Request (ms) Latency (ms)
140,603 98 167 2.37 207.8557 120.252 0.7448
139,339 96 168 2.2 194.9277 107.8954 0.7278
142,691 97 170 2.04 201.5164 103.8931 0.7875
139,297 96 169 2.08 214.0854 119.2582 0.8144
142,519 98 172 2.19 194.8844 116.9811 0.9509

functions.cmake Outdated Show resolved Hide resolved
@lpereira
Copy link

Curious to know where the ~20-35ms of startup time went when using LTO.

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@@ -108,6 +108,8 @@ llvm_link="$(locate_llvm_exec link)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-link"; exit 1; }
llvm_nm="$(locate_llvm_exec nm)"
[[ $? -eq 0 ]] || { echo "Unable to locate llvm-nm"; exit 1; }
llvm_ranlib="$(locate_llvm_exec ranlib)"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why is adding the ranlib necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

My surface understanding standing is that llvm-ranlib is intended to handle the clang output when when using the -flto flag, whereas the standard ranlib does not. Really, I just hit errors with using the standard ranlib when trying to do this and looking around online indicated that llvm-ranlib should be used in order to use LTO.

Copy link
Member

Choose a reason for hiding this comment

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

It was removed in #1363 because openSUSE distro did not have ranlib. If openSUSE is not exercised in the CI, that might be broken.

Copy link
Member

Choose a reason for hiding this comment

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

@am11 thank you for the info. I had a feeling that it was removed intentionally in the past, but I haven't remembered the reason. We don't build anything on OpenSUSE in our CI.

@elinor-fung
Copy link
Member Author

I'm honestly not sure where exactly the startup time went (I wasn't really expecting it, but definitely not complaining). I think there were still issues getting dependable traces.

@elinor-fung elinor-fung merged commit fa42bdf into dotnet:single-exe Sep 18, 2019
@elinor-fung elinor-fung deleted the enableLTO branch September 18, 2019 18:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants