Baseline had panic=abort only. Measured each setting in order (docs/RUST.md's new "APK size (2026-09-07)" subsection has the full table and crate breakdown): strip=true, lto="fat", codegen-units=1, opt-level="s" take libmain.so from 18,546,488 to 11,193,608 bytes (-39.7%) and the release APK from 20,678,956 to 13,326,076 bytes (-35.5%), arm64-v8a. opt-level="z" was measured (another ~800KB) but not adopted without a frame-time check. Investigated naga/wgpu backend features and tabs-ui/tabs-screen as trim candidates; both are already fully eliminated by the linker on Android (0 symbols in `llvm-nm` on the baseline .so), so no Cargo feature change would shrink the binary -- left as documented findings rather than a diff. Embedded Noto Sans fonts (3.6 MB) and the wgpu/naga/font-shaping stack account for most of what remains vs. Compose, which borrows the platform's own renderer and fonts for free; recorded honestly in the doc rather than trimmed, since subsetting fonts or dropping a backend would change what iris can render.
91 lines
4.6 KiB
TOML
91 lines
4.6 KiB
TOML
[package]
|
|
name = "iris-android-app"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
|
|
# Deliberately outside the `iris` workspace (see that Cargo.toml's
|
|
# `[workspace] exclude`): this crate exists only to be cross-compiled with
|
|
# `cargo ndk` for the emulator/a phone, and pulls in android-view, which
|
|
# needs the NDK sysroot to link. Folding it into the main workspace would
|
|
# make `cargo build --workspace --all-targets` -- the host command RUST.md
|
|
# and AGENTS.md both require to stay clean -- try to link a cdylib against
|
|
# libraries that do not exist on this machine. See RUST.md's I2.
|
|
|
|
[lib]
|
|
name = "main"
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
iris = { path = "../" }
|
|
android-view = { git = "https://github.com/rust-mobile/android-view.git", rev = "bec6c62a96cef8239b0fd7fedeef9b184d02e3a1" }
|
|
android_logger = "0.15.0"
|
|
log = "0.4.28"
|
|
# `tabs-screen` (default, I2/I4's demo) and `transcript-screen` (I5's
|
|
# Android integration) are mutually exclusive -- one `ActiveClient` type is
|
|
# compiled in, never both (`lib.rs`'s doc comment) -- so both sets of deps
|
|
# are optional and each screen's feature pulls in only its own. Without
|
|
# this, building `--features transcript-screen` alone (default features
|
|
# still on) left `tabs-ui` linked but never referenced under that cfg,
|
|
# which Cargo's `unused_dependencies` lint (on by default) correctly flags.
|
|
tabs-ui = { path = "../tabs-ui", optional = true }
|
|
transcript-ui = { path = "../transcript-ui", optional = true }
|
|
# P0's bench build only: the fixture and the folded screen both bench
|
|
# clients open, shared with the headless harness and the desktop window
|
|
# (docs/RUST.md's "Three test layers").
|
|
transcript-fixture = { path = "../transcript-fixture", optional = true }
|
|
client-core = { path = "../../client-core", optional = true }
|
|
event-model = { path = "../../event-model", optional = true }
|
|
serde_json = { version = "1", features = ["float_roundtrip"], optional = true }
|
|
# P0's bench build only (docs/RUST.md): `getrusage(RUSAGE_SELF)` for
|
|
# process CPU time, matching `libc::getrusage`'s mention in that box over
|
|
# parsing `/proc/self/stat` by hand and assuming `USER_HZ`. Already in the
|
|
# workspace's own dependency tree transitively (`iris/Cargo.lock`, pinned
|
|
# at 0.2.179) -- this makes it a direct dependency at the same version
|
|
# rather than a second, possibly-drifting resolution.
|
|
libc = { version = "0.2.179", optional = true }
|
|
# P0's bench build only: the scroll animation and the streaming phase are
|
|
# both a sequence of `sleep`s inside the async task `rsc.spawn_task` already
|
|
# runs on iris's own tokio runtime (`iris/src/task.rs`'s `Tasks::init`), and
|
|
# the battery sampler is a second, concurrent task on that same runtime
|
|
# (`tokio::spawn`) -- so this crate needs `tokio` directly rather than only
|
|
# through `iris`. `rt`+`time` only: no I/O, no macros, nothing this crate
|
|
# doesn't call. Version matches the one `iris`'s own dependency tree already
|
|
# resolves to (`iris/Cargo.lock`), so there is one copy of the runtime, not
|
|
# two.
|
|
tokio = { version = "1.53.1", features = ["rt", "time"], optional = true }
|
|
|
|
[features]
|
|
default = ["tabs-screen"]
|
|
tabs-screen = ["dep:tabs-ui"]
|
|
transcript-screen = ["dep:transcript-ui", "dep:client-core", "dep:event-model", "dep:serde_json"]
|
|
# RUST.md's I5 "Where iris's frame time goes": forces the GLES backend
|
|
# instead of SwiftShader's software Vulkan. See `iris/Cargo.toml`'s own doc
|
|
# on the feature this forwards to.
|
|
force-gles = ["iris/force-gles"]
|
|
# P0's iris half (docs/RUST.md, docs/AGENTS.md's "The rigs"): the same
|
|
# checked-in fixture, scroll loop and streaming phase the Compose `bench`
|
|
# build type drives, run here against `transcript-ui`'s real screen with no
|
|
# server. Depends on `transcript-screen` for `transcript-ui`/`client-core`/
|
|
# `event-model` -- `lib.rs`'s `ActiveClient` selection gives this feature
|
|
# priority over `transcript-screen`'s own `TranscriptClient` when both are
|
|
# listed, which is how this crate's build command names both explicitly.
|
|
bench = ["transcript-screen", "dep:transcript-fixture", "dep:libc", "dep:tokio"]
|
|
|
|
[profile.release]
|
|
panic = "abort"
|
|
# Measured 2026-09-07 (docs/RUST.md's "APK size" subsection): together these
|
|
# take libmain.so from 18,546,488 to 11,193,608 bytes (-39.7%) and the APK
|
|
# from 20,678,956 to 13,326,076 bytes (-35.5%), arm64-v8a release. `strip`
|
|
# also works around AGP's own stripReleaseDebugSymbols failing silently on
|
|
# this .so ("packaging them as they are"). `opt-level = "s"` over `"z"`:
|
|
# `z` measured another ~800 KB smaller but was not checked against iris's
|
|
# own frame-time bench, so it is not worth the unmeasured risk -- see the
|
|
# doc for the number and the follow-up this leaves.
|
|
strip = true
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
opt-level = "s"
|
|
|
|
[profile.dev]
|
|
panic = "abort"
|