FuelLabs
sway
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
Optimize initialization of mostly zeroed aggregates (#7542) This PR implements additional optimization based on `init_aggr` introduced in #7530 that lowers mostly-zeroed aggregates to a single `mem_clear_val` followed by a smaller number of `store`s. The decision to apply the optimization is based on an approximative heuristics that does not count the gas cost of the `store` based initialization and compares it to `mem_clear_val` and `store`s, but rather inspects the ratio of zeroed and not-zeroed elements in the aggregate. If the ratio is larger than the fixed threshold of 75%, the optimization is applied. The threshold is determined empirically by running benchmarks on real-life projects, most notably o2. The performance gains on real-life projects are minimal. E.g., on the o2 `trade-account` benchmarks: | | Improvements | Regressions | | - | -: | -: | | Count | 21 | — | | Average | 0.11% | — | | Median | 0.14% | — | | Max | 0.26% | — | | Min | 0.02% | — | Performance improvements on Sway tests are given in the comment below. The large regressions are analyzed. They are coming from non-realistic test conditions where all code get's inlined and SROA eliminates the aggregate if the `mem_clear_val` is not present. --------- Co-authored-by: Igor Rončević <ironcev@hotmail.com>
master
5 hours ago
Fix issue of calculating skip initialization with removed `init_aggr`
vaivaswatha/aggr_init_mostly_zero
20 hours ago
Add additional tests for `init_aggr` instruction and its lowering (#7678) ## Description This PR extends #7677 by: - addressing the issue of circular validation. In some of the tests, a created nested aggregate was asserted aginst an expected aggregate. A potential bug in initialization that might produce a same invalid value in the nested and expected aggregate would pass unnoticed. - adding more tests for the mostly-zeroed aggregates optimization that is being developed in #7542. - adding more `issues` tests. Those cover edge cases inspected while working on #7542 that were causing ICEs or sub-optimal lowerings. ## Checklist - [x] I have linked to any relevant issues. - [x] 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). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] 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. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
master
21 hours ago
Merge branch 'master' into vaivaswatha/aggr_init_mostly_zero
vaivaswatha/aggr_init_mostly_zero
1 day ago
Removing verify-ir from the CLI (#7672) ## Description This PR removes "verify-ir" from the CLI, because we now run verify after each optimization pass. The performance impact seems to be minimal and it is well worthy the extra security it brings. This brought to attention a problem that the pass "arg-demotion" had with blocks with "never" as arguments. A better fix will be pushed later, but for now, the pass does not generate a miscompilation anymore. Otehr smal fixes were "filter-fn" not working with contracts, and the IR printer not correctly printings storage key address with 64 characters when they start with zero. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
master
1 day ago
Adjust requires contract deployment, IR, and snapshot tests
vaivaswatha/aggr_init_mostly_zero
2 days ago
Adjust the threshold based on benchmarks
vaivaswatha/aggr_init_mostly_zero
2 days ago
Fix Clippy and fmt issues
vaivaswatha/aggr_init_mostly_zero
2 days ago
Latest Branches
CodSpeed Performance Gauge
-21%
Optimize initialization of mostly zeroed aggregates
#7542
21 hours ago
68201b3
vaivaswatha/aggr_init_mostly_zero
CodSpeed Performance Gauge
0%
Removing verify-ir from the CLI
#7672
3 days ago
93f2863
xunilrj/removing-cli-verify
CodSpeed Performance Gauge
0%
fix modified in optimisation passes so they converge
#7666
14 days ago
5946264
xunilrj/fix-opt-passes-convergence
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs