Skip to content

⚡ Bolt: Optimize Rust memory footprint & Cargo profile#554

Merged
tryigit merged 1 commit intomasterfrom
bolt-rust-memory-optimizations-11672702419596065688
Mar 26, 2026
Merged

⚡ Bolt: Optimize Rust memory footprint & Cargo profile#554
tryigit merged 1 commit intomasterfrom
bolt-rust-memory-optimizations-11672702419596065688

Conversation

@tryigit
Copy link
Owner

@tryigit tryigit commented Mar 26, 2026

⚡ Bolt: Optimize Rust memory footprint & Cargo.toml release profile

💡 What:

  1. Replaced AHashMap<String, String> with AHashMap<Box<str>, Box<str>> in caching layers (fingerprint.rs & properties.rs).
  2. Added panic = "abort" to the [profile.release] configuration in Cargo.toml.

🎯 Why:

  1. String structs carry a capacity field, taking 24 bytes per instance on 64-bit systems. Since these are cache entries that are never mutated/resized, using Box<str> drops the capacity pointer and reduces overhead to 16 bytes per string.
  2. The Android module is injected via Zygisk. In an embedded JNI/FFI environment, panics are effectively fatal. Building with panic = "abort" strips out the unwinding infrastructure.

📊 Impact:

  • Reduces .so binary size significantly by stripping unwind tables.
  • Reduces memory overhead for all globally cached strings by 33% per string.

🔬 Measurement:

  • Checked successfully using cargo test to ensure functional parity and safe Rust boundaries.

PR created automatically by Jules for task 11672702419596065688 started by @tryigit

💡 What:
1. Replaced `AHashMap<String, String>` with `AHashMap<Box<str>, Box<str>>` in caching layers (fingerprint.rs & properties.rs).
2. Added `panic = "abort"` to the `[profile.release]` configuration in `Cargo.toml`.

🎯 Why:
1. `String` structs carry a capacity field, taking 24 bytes per instance on 64-bit systems. Since these are cache entries that are never mutated/resized, using `Box<str>` drops the capacity pointer and reduces overhead to 16 bytes per string.
2. The Android module is injected via Zygisk. In an embedded JNI/FFI environment, panics are effectively fatal. Building with `panic = "abort"` strips out the unwinding infrastructure.

📊 Impact:
- Reduces `.so` binary size significantly by stripping unwind tables.
- Reduces memory overhead for all globally cached strings by 33% per string.

🔬 Measurement:
- Checked successfully using `cargo test` to ensure functional parity and safe Rust boundaries.
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@appwrite
Copy link

appwrite bot commented Mar 26, 2026

Yiğit

Project ID: 67b294d30004942511a5

Functions (1)
Function ID Status Logs
 Bootloader Hook 67b296050015d6532253 Queued Queued View Logs

Tip

Silent mode disables those chatty PR comments if you prefer peace and quiet

@tryigit tryigit merged commit 7ec6484 into master Mar 26, 2026
8 of 11 checks passed
@tryigit tryigit deleted the bolt-rust-memory-optimizations-11672702419596065688 branch March 26, 2026 06:35
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.

1 participant