Skip to content

perf: binary size analysis #182

Merged
junr03 merged 10 commits intomasterfrom
size-analysis
Jun 27, 2019
Merged

perf: binary size analysis #182
junr03 merged 10 commits intomasterfrom
size-analysis

Conversation

@junr03
Copy link
Copy Markdown
Member

@junr03 junr03 commented Jun 25, 2019

Signed-off-by: Jose Nino [email protected]

Description: This PR concludes binary size investigation slated for issue #17. The three deliverables of this PR are:

  1. Developer documentation that solidifies the building and analysis platform used for binary size analysis.
  2. A sorted list of issues for next steps in binary size reduction under the perf/size label.
  3. An final baseline size for the binary:

As of https://github.com/lyft/envoy-mobile/tree/f17caebcfce09ec5dcda905dc8418fea4d382da7
The test_binary_size_size as built by the toolchain against the architecture described (arm64 with clang and lld)
compiles to a stripped size of 8.9mb and a compressed size of 3mb.

Additionally #181 will add CI jobs to add size regression analysis on every PR.

Risk Level: low - add new bazel target and docs.
Docs Changes: added developer documentation.
Fixes #17

Jose Nino added 2 commits June 25, 2019 14:36
Signed-off-by: Jose Nino <[email protected]>
Signed-off-by: Jose Nino <[email protected]>
@junr03 junr03 requested a review from Reflejo June 25, 2019 23:29
@junr03
Copy link
Copy Markdown
Member Author

junr03 commented Jun 25, 2019

@Reflejo deliverables we talked about this morning. ptal when you have a chance.

@junr03 junr03 changed the title Size analysis perf: binary size analysis Jun 25, 2019
.bazelrc Outdated

build:fat --ios_multi_cpus=i386,x86_64,armv7,arm64 --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a

build:sizeopt -c opt --copt -Os --copt=-ggdb3 --linkopt=-fuse-ld=lld No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think lld would be compatible with the iOS build?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this also just get rolled into the release PR that @rebello95 is working on instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@keith does iOS use gold?

I can work with @rebello95 to consolidate. I do think that for release we want to do --strip=never, while here we want to keep symbols and manually strip after bazel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Apple has their own linker, ld64, and we have to use that one

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I see, thanks for the info. My idea with the sizeopt config was to use to get binaries for size analysis, not necessarily for release. So the linker stipulation here is just for standardization of the tooling used in that type of investigation.

I'll adjust the bazel config accordingly once we settle on the release config.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would likely just mean that we wouldn't be able to use --config=sizeopt with iOS, right now @rebello95's open PR is using that config in the release mode

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gotcha, ok. I just looked at @rebello95's PR. I think I was confused about the ordering here. Now I see that #155 depends on this. I have fixed in a way that I think makes everything work together lmk what you think @keith

fmt
Signed-off-by: Jose Nino <[email protected]>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Awesome! This is great work.

Can you please also provide notes on how you setup your ARM machine/instance/OS if there was anything interesting there? Or is it all standard Linux? If so maybe just note that and maybe reference which AWS machine you had success with if someone wants to try it out?

.bazelrc Outdated

build:fat --ios_multi_cpus=i386,x86_64,armv7,arm64 --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a

build:sizeopt -c opt --copt -Os --copt=-ggdb3 --linkopt=-fuse-ld=lld No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can this also just get rolled into the release PR that @rebello95 is working on instead?

Jose Nino added 6 commits June 26, 2019 10:13
Signed-off-by: Jose Nino <[email protected]>
Signed-off-by: Jose Nino <[email protected]>
Signed-off-by: Jose Nino <[email protected]>
Signed-off-by: Jose Nino <[email protected]>
fmt
Signed-off-by: Jose Nino <[email protected]>
Copy link
Copy Markdown
Contributor

@rebello95 rebello95 left a comment

Choose a reason for hiding this comment

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

LGTM! Will let @goaway review/approve as well.

Signed-off-by: Jose Nino <[email protected]>
Copy link
Copy Markdown
Contributor

@goaway goaway left a comment

Choose a reason for hiding this comment

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

This is fantastic @junr03! Especially appreciate the detailed documentation.

@junr03 junr03 dismissed mattklein123’s stale review June 27, 2019 21:06

I addressed all of the review's comments

@junr03 junr03 merged commit 8547cd1 into master Jun 27, 2019
@junr03 junr03 deleted the size-analysis branch June 27, 2019 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reduce binary size

6 participants