-
-
Notifications
You must be signed in to change notification settings - Fork 127
perf(size): -1.47 MiB (-13.3%) stripped binary — build-config levers + control-plane demonomorphization #1055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f08db9
588c50a
24863b2
c2baa36
f2f8f70
58680d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Workspace build configuration. Applies to builds of THIS repo only — | ||
| # crates.io consumers are unaffected (cargo does not inherit this file | ||
| # across package boundaries). | ||
|
|
||
| [target.x86_64-unknown-linux-gnu] | ||
| # -Zshare-generics=y: downstream crates reuse upstream monomorphic | ||
| # instantiations instead of stamping per-crate copies with distinct symbol | ||
| # hashes that fat LTO cannot merge (measured -335 KiB on the stripped demo; | ||
| # the Docker image build already ran with this flag). Nightly-only, and the | ||
| # toolchain is pinned by rust-toolchain.toml. | ||
| # lld + ICF: lld lays out the fat-LTO object tighter than BFD ld and folds | ||
| # byte-identical sections (measured -73 KiB on the stripped demo). Scoped to | ||
| # this target so wasm and non-Linux builds keep their default linkers. | ||
| # -Clinker-features=+lld selects the rust-lld bundled with the pinned | ||
| # toolchain, so contributors need no system lld package. Still | ||
| # unstable-gated on this nightly, hence -Zunstable-options (the block is | ||
| # nightly-only anyway; CI's stable job opts out via RUSTFLAGS=""). | ||
| rustflags = [ | ||
| "-Zshare-generics=y", | ||
| "-Zunstable-options", | ||
| "-Clinker-features=+lld", | ||
| "-Clink-arg=-Wl,--icf=all", | ||
| ] | ||
|
Comment on lines
+11
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🔵 Trivial Consider enabling Look, optimizing the Linux target with 🤖 Prompt for AI Agents |
||
|
|
||
| [env] | ||
| # Trim bundled-SQLite subsystems the workspace never touches. FTS5 stays: | ||
| # chat-store's `search` feature builds its index on it. Shared cache stays: | ||
| # sqlite-storage's in-memory mode shares one DB across the pool via | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| # `cache=shared` URIs. JSON and extension loading are unused by | ||
| # diesel/sqlite-storage/chat-store (checked: no json_* SQL, no | ||
| # load_extension callers); dropping loadable extensions also removes a | ||
| # dlopen surface. STAT4/DBSTAT/RTREE/FTS3/SOUNDEX are upstream-default-off | ||
| # features libsqlite3-sys turns on; none are exercised here. | ||
| LIBSQLITE3_FLAGS = "-USQLITE_ENABLE_FTS3 -USQLITE_ENABLE_FTS3_PARENTHESIS -USQLITE_ENABLE_RTREE -USQLITE_ENABLE_STAT4 -USQLITE_ENABLE_DBSTAT_VTAB -USQLITE_SOUNDEX -DSQLITE_OMIT_JSON -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,8 @@ | |
| /*.xml | ||
| /*.txt | ||
| /whatsapp_store | ||
| /.cargo | ||
| /.cargo/* | ||
| !/.cargo/config.toml | ||
| /.vscode | ||
| /*.db* | ||
| .env | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1305,7 +1305,26 @@ impl BotBuilder<Provided, Provided, Provided, Provided> { | |
| if let Some(override_) = self.device_props_override | ||
| && !override_.is_empty() | ||
| { | ||
| info!("Applying device props override: {:?}", override_); | ||
| // Field-by-field to avoid Debug-formatting waproto types (keeps their | ||
| // generated Debug impls out of the binary). | ||
| info!( | ||
| "Applying device props override: os={:?} version={:?} platform_type={:?} history_sync_config={}", | ||
| override_.os.as_deref(), | ||
| override_.version.as_ref().map(|v| { | ||
| format!( | ||
| "{}.{}.{}", | ||
| v.primary.unwrap_or(0), | ||
| v.secondary.unwrap_or(0), | ||
| v.tertiary.unwrap_or(0) | ||
| ) | ||
| }), | ||
|
Comment on lines
+1313
to
+1320
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value Avoid heap allocation for log formatting. Look, we need WhatsApp to run as lean as possible if we're going to connect the world. Shrinking the binary is exactly what I expect from this team. However, you're allocating a 🤖 Prompt for AI Agents |
||
| override_.platform_type.map(|p| p as i32), | ||
| if override_.history_sync_config.is_some() { | ||
| "overridden" | ||
| } else { | ||
| "default" | ||
| }, | ||
| ); | ||
| persistence_manager | ||
| .process_command(DeviceCommand::SetDeviceProps(override_)) | ||
| .await; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
test-stablejob in.github/workflows/main.ymlexplicitly installs the stable toolchain and then runs several x86_64 Linux Cargo builds, so this target-level flag is applied there and makes every build fail before compilation.rustc --help -vdescribes-Zas “unstable compiler options,” and stable rustc rejects them; the repository's pinned nightly does not override the toolchain selected bydtolnay/rust-toolchain@stable. Apply this size flag only to the nightly release build or otherwise exclude the stable job.Useful? React with 👍 / 👎.