Skip to content

Improve compilation efficiency and caching - #11

Merged
pawelchcki merged 5 commits into
mainfrom
improve_compilation_and_caching
Aug 9, 2026
Merged

pawelchcki merged 5 commits into
mainfrom
improve_compilation_and_caching

Conversation

@pawelchcki

Copy link
Copy Markdown
Owner

Summary

  • Optimized release profile: Switch from aggressive settings (opt-level=z, fat LTO, codegen-units=1) to a balanced configuration (opt-level=s, thin LTO, codegen-units=16, panic=abort) — expected ~3-5x faster release builds per target with minimal size increase
  • Gradle up-to-date checks: Declare inputs/outputs on Rust build tasks so Gradle skips recompilation when only Dart code changed
  • Parallel ABI builds: Enable org.gradle.parallel=true so the 4 Android ABIs build concurrently instead of sequentially
  • CI improvements: Re-enable incremental compilation, share Rust cache across clippy/test/build jobs, and add an Android cross-compilation smoke test (arm64, debug)
  • sccache guidance: Document opt-in RUSTC_WRAPPER=sccache for cross-target compilation caching (not hardcoded in config to avoid breaking builds without sccache installed)
  • Fix warning: Prefix unused variable in flutter_ffi.rs to eliminate release build warning

Test plan

  • cargo clippy --all-targets --workspace -- -D warnings passes with zero warnings
  • cargo build --workspace --release completes with zero warnings
  • cargo check -p razemify-wasm --target wasm32-unknown-unknown compiles cleanly
  • Run flutter build apk twice — second run should show Rust tasks as UP-TO-DATE
  • Verify .so file sizes are acceptable (expected ~5-10% larger than before)
  • CI Android job passes on GitHub Actions

Optimize the release profile (thin LTO, codegen-units=16, opt-level=s),
add Gradle up-to-date checks so Rust rebuilds are skipped when sources
haven't changed, enable parallel ABI builds, share CI cache across jobs,
and add an Android cross-compilation smoke test.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @pawelchcki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the build process for the project, particularly for Rust and Android components. It focuses on reducing compilation times and improving caching mechanisms, leading to faster development cycles and more efficient CI/CD pipelines. These changes aim to provide a smoother and quicker build experience for developers and continuous integration systems.

Highlights

  • Optimized Release Profile: Switched from aggressive settings (opt-level=z, fat LTO, codegen-units=1) to a balanced configuration (opt-level=s, thin LTO, codegen-units=16, panic=abort), expecting ~3-5x faster release builds per target with minimal size increase.
  • Gradle Up-to-Date Checks: Declared inputs/outputs on Rust build tasks so Gradle skips recompilation when only Dart code has changed.
  • Parallel ABI Builds: Enabled org.gradle.parallel=true to allow the 4 Android ABIs to build concurrently instead of sequentially.
  • CI Improvements: Re-enabled incremental compilation, shared Rust cache across clippy/test/build jobs, and added an Android cross-compilation smoke test (arm64, debug).
  • sccache Guidance: Documented opt-in RUSTC_WRAPPER=sccache for cross-target compilation caching, avoiding hardcoding to prevent breaking builds without sccache installed.
  • Warning Fix: Prefixed an unused variable in flutter_ffi.rs to eliminate a release build warning.
Changelog
  • .cargo/config.toml
    • Added comments explaining how to enable sccache for cross-target compilation caching.
  • Cargo.toml
    • Updated the [profile.release] configuration to use opt-level = "s", lto = "thin", codegen-units = 16, strip = true, and panic = "abort" for optimized build speed and binary size.
  • flutter_razemify/android/build.gradle
    • Declared inputs and outputs for Rust build tasks to enable Gradle's up-to-date checks, preventing unnecessary recompilations.
  • flutter_razemify/example/android/gradle.properties
    • Enabled org.gradle.parallel=true to allow parallel execution of Gradle tasks, specifically for Android ABI builds.
  • flutter_razemify/rust/Cargo.toml
    • Removed the redundant [profile.release] section, as the workspace-level Cargo.toml now defines the release profile.
  • razemify-core/src/flutter_ffi.rs
    • Modified an unused variable e to _e in an Err block to suppress a compiler warning.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several significant improvements to the build process, focusing on compilation speed and caching. The changes to the release profile in Cargo.toml are well-reasoned and should provide a good balance between build time and binary size. Enabling parallel builds in Gradle and adding input/output declarations for the Rust tasks are excellent steps towards faster and more reliable builds. I've found one issue with the Gradle input declarations that could lead to incorrect caching behavior. Otherwise, the changes are solid and align well with the stated goals.

Comment thread flutter_razemify/android/build.gradle Resolved
…prove_compilation_and_caching

# Conflicts:
#	.github/workflows/ci.yml
#	Cargo.toml
#	flutter_razemify/android/build.gradle
#	flutter_razemify/rust/Cargo.toml
#	razemify-core/src/flutter_ffi.rs
@pawelchcki

Copy link
Copy Markdown
Owner Author

/gemini review

@pawelchcki

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b98fd7811d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread flutter_razemify/android/build.gradle Resolved
@pawelchcki

Copy link
Copy Markdown
Owner Author

@codex review

@pawelchcki pawelchcki closed this Aug 9, 2026
@pawelchcki pawelchcki reopened this Aug 9, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 5b18337175

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@pawelchcki
pawelchcki merged commit b39e152 into main Aug 9, 2026
2 checks passed
@pawelchcki
pawelchcki deleted the improve_compilation_and_caching branch August 9, 2026 21:50
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