rust-lang / rust-lang/rust

stdlib code size increase in nightly-2024-09-01 for aarch64-linux-android

Open
#130,320 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-android P-medium regression-from-stable-to-stable T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

We keep track of our code size on Android to keep our overall download size down. In updating our pinned nightly compiler (from nightly-2024-06-21; we're due for it), our CI turned up a code size increase of ~120KB in a library that's overall about 4.6MB—not huge, but not expected either. Bisecting on Rust toolchains turned up that the regression was introduced in nightly-2024-09-01 (as in, nightly-2024-08-30 does not have this extra code size, and there was no nightly-2024-08-31), and moreover I discovered that using -Zbuild-std recovered the additional code size. So something changed in how the prebuilt standard library is built, in a way that may not have been intended.

Unfortunately, our Android build process does a whole bunch of work at once, so I don't have a minimal example for you. My reproduction has been

  1. Install the Android NDK (27.0.12077973 is the one we're currently using)
  2. Check out https://github.com/signalapp/libsignal/releases/tag/v0.57.1
  3. ANDROID_NDK_HOME=path/to/ndk/27.0.12077973 java/build_jni.sh android-arm64
  4. Save the resulting library, then repeat with RUSTUP_TOOLCHAIN=nightly-2024-09-01.
  5. Compare the libraries' post-stripped sizes, or use a tool like bloaty to measure VM size only

It's possible this change was expected, in which case please close the issue; I understand code sizes go up sometimes!

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported reproduction: install Android NDK 27.0.12077973, check out libsignal v0.57.1, and run java/build_jni.sh android-arm64 with the affected nightly toolchain. Compare stripped library or VM sizes between nightly-2024-08-30 and nightly-2024-09-01, then compare against a build using -Zbuild-std. Done means identifying whether the prebuilt standard library build caused the regression and documenting or fixing its cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
build-system, compilers, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.