-
Notifications
You must be signed in to change notification settings - Fork 1
Enable full LTO in both workspaces #23
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
base: main
Are you sure you want to change the base?
Conversation
|
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.
Pull Request Overview
This PR enables full Link Time Optimization (LTO) in both the main and TEE workspaces to reduce binary sizes at the cost of increased compilation time. According to the provided benchmarks, this change reduces main workspace binaries by 22.4% and TEE workspace binaries by 4.8%, while adding approximately 1 minute to full compilation times.
- Enables
lto = "fat"in the main workspace Cargo.toml - Enables
lto = "fat"in the TEE workspace Cargo.toml
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Cargo.toml | Adds LTO configuration to main workspace profile |
| tee/Cargo.toml | Adds LTO configuration to TEE workspace profile |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
WalkthroughTop-level Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing touches🧪 Generate unit tests
Comment |
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
tee/Cargo.toml (1)
44-46: Avoid pinning in-repo crates via git rev; prefer local paths (or a patch) to prevent drift.Pointing to this same repo via a fixed
revrisks version skew and double bumping (you already note this). Use relativepathdeps for in-repo builds; Nix can still pin externally if needed.Proposed change (verify paths):
-shielder-circuits = { git = "https://github.com/Cardinal-Cryptography/blanksquare-monorepo", rev = "8d17e23ee807e2f1b40b31ffba27c1276afdb81f" } -type-conversions = { git = "https://github.com/Cardinal-Cryptography/blanksquare-monorepo", rev = "8d17e23ee807e2f1b40b31ffba27c1276afdb81f" } -powers-of-tau = { git = "https://github.com/Cardinal-Cryptography/blanksquare-monorepo", rev = "8d17e23ee807e2f1b40b31ffba27c1276afdb81f" } +shielder-circuits = { path = "../crates/shielder-circuits" } +type-conversions = { path = "../crates/type-conversions" } +powers-of-tau = { path = "../crates/powers-of-tau" }If external consumers must stay pinned, consider a Cargo patch to map these to local paths for in-repo builds, and keep Nix pinning for reproducible external builds.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Cargo.toml(1 hunks)tee/Cargo.toml(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Build wasm package without circuits / Build wasm packages
- GitHub Check: Build wasm package / Build wasm packages
- GitHub Check: Generate and compile contracts / Generate, compile and lint contracts
- GitHub Check: Measure gas usage / Measure gas and verifier code size
| #[profile.release] | ||
| lto = "fat" |
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.
LTO not actually enabled at the workspace: header is commented; setting is ignored.
Same issue as in tee: Cargo ignores lto outside a [profile.*] table.
Apply:
-#[profile.release]
-lto = "fat"
+[profile.release]
+lto = "fat"🤖 Prompt for AI Agents
In Cargo.toml around lines 139 to 140, the profile header is commented out so
the lto = "fat" setting is ignored; remove the leading '#' to make it an actual
profile table ([profile.release]) so Cargo applies the lto setting at this
manifest scope (if you intend workspace-wide settings, ensure this table is in
the workspace root Cargo.toml; otherwise place it in each package's Cargo.toml).
| #[profile.release] | ||
| lto = "fat" |
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.
LTO not actually enabled: profile header is commented out.
#[profile.release] is a comment; lto = "fat" at top-level is ignored by Cargo. Net effect: no LTO.
Apply:
-#[profile.release]
-lto = "fat"
+[profile.release]
+lto = "fat"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #[profile.release] | |
| lto = "fat" | |
| [profile.release] | |
| lto = "fat" |
🤖 Prompt for AI Agents
In tee/Cargo.toml around lines 48-49 the profile header is commented out
(`#[profile.release]`) so the `lto = "fat"` setting is at top-level and ignored;
to enable LTO change the commented header to a proper TOML table header
`[profile.release]` and place `lto = "fat"` (and any other profile keys) beneath
it so Cargo recognizes and applies LTO for release builds.
|
@coderabbitai configuration |
CodeRabbit configurationlanguage: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
high_level_summary_in_walkthrough: false
auto_title_placeholder: '@coderabbitai'
auto_title_instructions: ''
review_status: true
commit_status: true
fail_commit_status: false
collapse_walkthrough: false
changed_files_summary: true
sequence_diagrams: true
estimate_code_review_effort: true
assess_linked_issues: true
related_issues: true
related_prs: true
suggested_labels: true
auto_apply_labels: false
suggested_reviewers: true
auto_assign_reviewers: false
poem: true
labeling_instructions: []
path_filters: []
path_instructions: []
abort_on_close: true
disable_cache: false
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
ignore_usernames: []
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true
pre_merge_checks:
docstrings:
mode: warning
threshold: 80
title:
mode: warning
requirements: ''
description:
mode: warning
issue_assessment:
mode: warning
custom_checks: []
tools:
ast-grep:
rule_dirs: []
util_dirs: []
essential_rules: true
packages: []
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_rules: []
disabled_rules: []
enabled_categories: []
disabled_categories: []
enabled_only: false
level: default
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
phpmd:
enabled: true
phpcs:
enabled: true
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
flake8:
enabled: true
rubocop:
enabled: true
buf:
enabled: true
regal:
enabled: true
actionlint:
enabled: true
pmd:
enabled: true
cppcheck:
enabled: true
semgrep:
enabled: true
circleci:
enabled: true
clippy:
enabled: true
sqlfluff:
enabled: true
prismaLint:
enabled: true
pylint:
enabled: true
oxc:
enabled: true
shopifyThemeCheck:
enabled: true
luacheck:
enabled: true
brakeman:
enabled: true
dotenvLint:
enabled: true
htmlhint:
enabled: true
checkmake:
enabled: true
osvScanner:
enabled: true
chat:
art: true
auto_reply: true
integrations:
jira:
usage: auto
linear:
usage: auto
knowledge_base:
opt_out: false
web_search:
enabled: true
code_guidelines:
enabled: true
filePatterns: []
learnings:
scope: auto
issues:
scope: auto
jira:
usage: auto
project_keys: []
linear:
usage: auto
team_keys: []
pull_requests:
scope: auto
mcp:
usage: auto
disabled_servers: []
code_generation:
docstrings:
language: en-US
path_instructions: []
unit_tests:
path_instructions: []
|
|
@coderabbitai Please implement the changes you suggested in your code review. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI need to check what changes I suggested in my previous code review. Let me search for my review comments on this PR. 🏁 Script executed: Length of output: 2382 I found my previous review suggestion! I recommended replacing git dependencies with local path dependencies in 🏁 Script executed: Length of output: 75 Perfect! I can see the crates are located in the 🏁 Script executed: Length of output: 1654 Now I'll implement the changes I suggested by replacing the git dependencies with local path dependencies: 🏁 Script executed: Length of output: 1431 Perfect! I've successfully implemented the changes I suggested in my code review. Let me also update the comment above those dependencies since it's no longer relevant: 🏁 Script executed: Length of output: 1717 @Marcin-Radecki I've successfully implemented the changes I suggested in my code review! ✅ Here's what I've done: Changes made to
Benefits of these changes:
The changes maintain the same functionality while making the dependency management much cleaner and more maintainable. External consumers can still use Nix for reproducible builds if needed, while in-repo builds now use the local crate versions directly. 🐰✨ |
Summary
This PR enables full LTO in the both workspaces. This make binary size smaller, but increase overall compilation time (around 1 minute). Binary performance might increase.
Details
cargo test --release, which is really as Rust test harness linked with compiled object files). So what's almost identical is PR commit total run time (still around 20 minutes). What changes is when one runscargo build --release, this is where LTO kicks in. In the below comparison, you can see binaries being build with and without LTO. Only the first binaryar-cliis build from scratch, so you can see that with full LTO is one minute more. The latter binaries are reusing object files compiles from the previous build, so really what this shows is binary linking time.LTO demonstrates significant size reduction benefits across both workspaces, with the main workspace seeing more dramatic improvements than the TEE workspace.
Main Workspace Analysis
The main workspace shows substantial binary size reductions with LTO enabled:
Total size reduction: 22.4% (from 145.44 MB to 112.96 MB)
Absolute savings: 32.48 MB
The TEE workspace shows more modest but still meaningful improvements:
Total size reduction: 4.8% (from 51.12 MB to 46.54 MB)
Absolute savings: 4.58 MB
Summary by CodeRabbit