Skip to content

More IR optimisation rounds#7680

Open
xunilrj wants to merge 2 commits into
masterfrom
xunilrj/more-opt-rounds
Open

More IR optimisation rounds#7680
xunilrj wants to merge 2 commits into
masterfrom
xunilrj/more-opt-rounds

Conversation

@xunilrj

@xunilrj xunilrj commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

Now that optimisation passes converge, we increase the number of rounds.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@xunilrj xunilrj self-assigned this Jul 13, 2026
@xunilrj
xunilrj requested review from a team as code owners July 13, 2026 16:53
@xunilrj
xunilrj temporarily deployed to fuel-sway-bot July 13, 2026 16:53 — with GitHub Actions Inactive
@xunilrj

xunilrj commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

e2e gas usage

Improvements Regressions
Count 1065 129
Average 0.53% -2.26%
Median 0.17% -2.16%
Max 54.51% -8.04%
Min 0.01% -0.01%

| should_pass/language/u256/u256_operators (test.toml)::should_be_able_to_use_comparison_operators | 510 | 232 | 54.51% |
| should_pass/language/intrinsics/storage_intrinsics (test.toml)::test_state_clear_slots_empty_slots | 1692 | 1828 | -8.04% |

e2e bytecode size

Improvements Regressions
Count 67 31
Average 4.73% -17.02%
Median 1.71% -4.09%
Max 57.14% -154.97%
Min 0.05% -0.21%

| should_pass/language/dereferenced_projection_reassignment (test.toml) | 168 | 72 | 57.14% |
| should_pass/language/references/impl_reference_types (test.toml) | 5632 | 14360 | -154.97% |

in lang gas usage

Improvements Regressions
Count
Average
Median
Max
Min

in lang bytecode size

Improvements Regressions
Count
Average
Median
Max
Min

o2 byte code

Improvements Regressions
Count 3 2
Average 1.39% -1.53%
Median 1.47% -1.53%
Max 1.61% -2.09%
Min 1.10% -0.97%
Test Before After Percentage
./mocks/src20-token 19008 19192 -0.97%
./contracts/order-book 61144 62424 -2.09%
./contracts/order-book-registry 12312 12176 1.10%
./contracts/order-book-whitelist 5960 5864 1.61%
./contracts/order-book-blacklist 6000 5912 1.47%

o2 gas usage

Improvements Regressions
Count 1
Average -0.22%
Median -0.22%
Max -0.22%
Min -0.22%
Test Before After Percentage
contract_libs::test_u56 463 464 -0.22%

@ironcev ironcev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a bit surprising. Intuitively, I've expected mostly improvements and very few regressions. The bytecode size increase is likely coming from more inlining. Numerous increases in gas usage are not that easy to explain at the first look.

With this number of regressions, their unpredictably looking distribution, and negative impact on o2, I rather wouldn't proceed with this PR and stay at two rounds that brought good gains.

Or at least, I wouldn't proceed until we analyze the regressions in more detail and see the impact on o2 benchmarks. It would definitely be a good additional insight into our IR optimizations and pipeling to understand the regressions. But on the other side I am not sure if it is worth the effort and we just close this PR without merging and proceed with other optimizations where we know we will surely have good gains.

@ironcev ironcev changed the title More optisation rounds More IR optimisation rounds Jul 14, 2026
@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: ir IRgen and sway-ir including optimization passes performance Everything related to performance, speed wise or memory wise. labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler: ir IRgen and sway-ir including optimization passes compiler General compiler. Should eventually become more specific as the issue is triaged performance Everything related to performance, speed wise or memory wise.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants