Skip to content

Conversation

LucasSte
Copy link
Collaborator

@LucasSte LucasSte commented Mar 6, 2025

When we enable ALU32 with SBPFv2 and SBPFv3, rustc starts inlining more functions than before, since they may be smaller. Such aggressive inning increases program size.

Building the rust lib with the "s" option prevents inlining and loop unrolling.

rust/config.example.toml

Lines 429 to 443 in 08b7341

# Whether or not to optimize when compiling the compiler and standard library,
# and what level of optimization to use.
# WARNING: Building with optimize = false is NOT SUPPORTED. Due to bootstrapping,
# building without optimizations takes much longer than optimizing. Further, some platforms
# fail to build without this optimization (c.f. #65352).
# The valid options are:
# true - Enable optimizations.
# false - Disable optimizations.
# 0 - Disable optimizations.
# 1 - Basic optimizations.
# 2 - Some optimizations.
# 3 - All optimizations.
# "s" - Optimize for binary size.
# "z" - Optimize for binary size, but also turn off loop vectorization.
#optimize = true

@LucasSte LucasSte requested a review from Lichtso March 6, 2025 20:21
@LucasSte LucasSte marked this pull request as ready for review March 6, 2025 20:21
@LucasSte LucasSte merged commit 5ef2155 into anza-xyz:solana-1.79.0 Mar 6, 2025
18 checks passed
@LucasSte LucasSte deleted the bin-size branch March 6, 2025 21:00
LucasSte added a commit to LucasSte/rust that referenced this pull request Mar 14, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Apr 8, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Apr 9, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Apr 9, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Aug 21, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Aug 21, 2025
LucasSte added a commit to LucasSte/rust that referenced this pull request Sep 12, 2025
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.

2 participants