Skip to content

Improve fn order to decrease the number of back jmps - #7720

Open
xunilrj wants to merge 18 commits into
masterfrom
xunilrj/decrease-back-jmps
Open

Improve fn order to decrease the number of back jmps#7720
xunilrj wants to merge 18 commits into
masterfrom
xunilrj/decrease-back-jmps

Conversation

@xunilrj

@xunilrj xunilrj commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

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 deployed to fuel-sway-bot August 25, 2026 00:24 — with GitHub Actions Active
@xunilrj xunilrj changed the title Xunilrj/decrease back jmps Improve fn order to decrease the number of back jmps Aug 25, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 25, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 25 untouched benchmarks


Comparing xunilrj/decrease-back-jmps (950bca7) with master (08dad8c)

Open in CodSpeed

@xunilrj
xunilrj deployed to fuel-sway-bot August 25, 2026 00:56 — with GitHub Actions Active
@xunilrj xunilrj self-assigned this Aug 25, 2026
@xunilrj
xunilrj deployed to fuel-sway-bot August 25, 2026 01:32 — with GitHub Actions Active
@xunilrj
xunilrj deployed to fuel-sway-bot August 25, 2026 01:36 — with GitHub Actions Active
@xunilrj
xunilrj deployed to fuel-sway-bot August 25, 2026 10:19 — with GitHub Actions Active
@xunilrj

xunilrj commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Benchmark report

xunilrj/decrease-back-jmps @950bca7b vs master @08dad8c5

e2e-gas-usages

Improvements Regressions
Count 1460
Average 0.13%
Median 0.04%
Max 6.98%
Min 0.01%

Distribution

Histogram for Percentage (bars: 10, sum: 1,522n, max: 1,468n):

>= 0      <  0.6980 |1,468n  96.45%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.6980 <  1.3960 |   22n   1.45%|■                                  |
>= 1.3960 <  2.0940 |   26n   1.71%|■                                  |
>= 2.0940 <  2.7920 |    2n   0.13%|■                                  |
>= 2.7920 <  3.49   |    3n   0.20%|■                                  |
>= 3.49   <  4.1880 |    0n   0.00%|                                   |
>= 4.1880 <  4.8860 |    0n   0.00%|                                   |
>= 4.8860 <  5.5840 |    0n   0.00%|                                   |
>= 5.5840 <  6.2820 |    0n   0.00%|                                   |
>= 6.2820 <= 6.98   |    1n   0.07%|■                                  |

e2e-bytecode-sizes

Improvements Regressions
Count 48
Average 1.51%
Median 1.19%
Max 7.73%
Min 0.11%

Distribution

Histogram for Percentage (bars: 10, sum: 48n, max: 22n):

>= 0.11   <  0.872  |22n  45.83%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.872  <  1.634  | 6n  12.50%|■■■■■■■■■■■                           |
>= 1.634  <  2.396  | 9n  18.75%|■■■■■■■■■■■■■■■■                      |
>= 2.396  <  3.158  | 8n  16.67%|■■■■■■■■■■■■■■                        |
>= 3.158  <  3.92   | 2n   4.17%|■■■■                                  |
>= 3.92   <  4.682  | 0n   0.00%|                                      |
>= 4.682  <  5.4440 | 0n   0.00%|                                      |
>= 5.4440 <  6.2060 | 0n   0.00%|                                      |
>= 6.2060 <  6.9680 | 0n   0.00%|                                      |
>= 6.9680 <= 7.73   | 1n   2.08%|■■                                    |

in-language-gas-usages

Improvements Regressions
Count 184
Average 0.77%
Median 0.37%
Max 6.49%
Min 0.01%

Distribution

Histogram for Percentage (bars: 10, sum: 192n, max: 115n):

>= 0     <  0.649 |115n  59.90%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.649 <  1.298 | 35n  18.23%|■■■■■■■■■■■■                           |
>= 1.298 <  1.947 | 22n  11.46%|■■■■■■■■                               |
>= 1.947 <  2.596 | 15n   7.81%|■■■■■■                                 |
>= 2.596 <  3.245 |  3n   1.56%|■■                                     |
>= 3.245 <  3.894 |  1n   0.52%|■                                      |
>= 3.894 <  4.543 |  0n   0.00%|                                       |
>= 4.543 <  5.192 |  0n   0.00%|                                       |
>= 5.192 <  5.841 |  0n   0.00%|                                       |
>= 5.841 <= 6.49  |  1n   0.52%|■                                      |

in-language-bytecode-sizes

Improvements Regressions
Count 38
Average 0.44%
Median 0.41%
Max 1.55%
Min 0.01%

Distribution

Histogram for Percentage (bars: 10, sum: 38n, max: 10n):

>= 0.01  <  0.164  | 7n  18.42%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■           |
>= 0.164 <  0.318  | 9n  23.68%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■   |
>= 0.318 <  0.472  | 6n  15.79%|■■■■■■■■■■■■■■■■■■■■■■■■               |
>= 0.472 <  0.626  |10n  26.32%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.626 <  0.78   | 1n   2.63%|■■■■                                   |
>= 0.78  <  0.934  | 2n   5.26%|■■■■■■■■                               |
>= 0.934 <  1.088  | 1n   2.63%|■■■■                                   |
>= 1.088 <  1.242  | 1n   2.63%|■■■■                                   |
>= 1.242 <  1.396  | 0n   0.00%|                                       |
>= 1.396 <= 1.5499 | 1n   2.63%|■■■■                                   |

fuel-o2-exports / order-book

Improvements Regressions
Count 33
Average 0.13%
Median 0.13%
Max 0.29%
Min 0.05%

Distribution

Histogram for Percentage (bars: 10, sum: 34n, max: 11n):

>= 0      <  0.0289 | 1n   2.94%|■■■■                                  |
>= 0.0289 <  0.0579 | 5n  14.71%|■■■■■■■■■■■■■■■■■■                    |
>= 0.0579 <  0.087  | 3n   8.82%|■■■■■■■■■■■                           |
>= 0.087  <  0.1159 | 4n  11.76%|■■■■■■■■■■■■■■                        |
>= 0.1159 <  0.145  | 5n  14.71%|■■■■■■■■■■■■■■■■■■                    |
>= 0.145  <  0.174  |11n  32.35%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.174  <  0.2029 | 4n  11.76%|■■■■■■■■■■■■■■                        |
>= 0.2029 <  0.2319 | 0n   0.00%|                                      |
>= 0.2319 <  0.261  | 0n   0.00%|                                      |
>= 0.261  <= 0.29   | 1n   2.94%|■■■■                                  |

fuel-o2-exports / trade-account

Improvements Regressions
Count 21
Average 0.06%
Median 0.05%
Max 0.18%
Min 0.02%

Distribution

Histogram for Percentage (bars: 10, sum: 21n, max: 10n):

>= 0.02   <  0.0360 | 4n  19.05%|■■■■■■■■■■■■■■■■                      |
>= 0.0360 <  0.0520 |10n  47.62%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.0520 <  0.068  | 2n   9.52%|■■■■■■■■                              |
>= 0.068  <  0.084  | 2n   9.52%|■■■■■■■■                              |
>= 0.084  <  0.1    | 0n   0.00%|                                      |
>= 0.1    <  0.116  | 1n   4.76%|■■■■                                  |
>= 0.116  <  0.132  | 1n   4.76%|■■■■                                  |
>= 0.132  <  0.1480 | 0n   0.00%|                                      |
>= 0.1480 <  0.1640 | 0n   0.00%|                                      |
>= 0.1640 <= 0.18   | 1n   4.76%|■■■■                                  |

snapshot-gas-usages

Improvements Regressions
Count 73
Average 0.16%
Median 0.07%
Max 0.52%
Min 0.04%

Distribution

Histogram for Percentage (bars: 10, sum: 73n, max: 38n):

>= 0.04   <  0.088  |38n  52.05%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.088  <  0.136  | 5n   6.85%|■■■■■                                 |
>= 0.136  <  0.184  | 6n   8.22%|■■■■■■                                |
>= 0.184  <  0.2319 | 3n   4.11%|■■■                                   |
>= 0.2319 <  0.2799 | 5n   6.85%|■■■■■                                 |
>= 0.2799 <  0.3279 | 1n   1.37%|■                                     |
>= 0.3279 <  0.3759 | 2n   2.74%|■■                                    |
>= 0.3759 <  0.4239 |11n  15.07%|■■■■■■■■■■■                           |
>= 0.4239 <  0.4719 | 0n   0.00%|                                      |
>= 0.4719 <= 0.5199 | 2n   2.74%|■■                                    |

snapshot-bytecode-sizes

Improvements Regressions
Count 8
Average 0.98%
Median 0.54%
Max 1.94%
Min 0.28%

Distribution

Histogram for Percentage (bars: 10, sum: 8n, max: 3n):

>= 0.28   <  0.446  |3n  37.50%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|
>= 0.446  <  0.612  |2n  25.00%|■■■■■■■■■■■■■■■■■■■■■■■■■■             |
>= 0.612  <  0.778  |0n   0.00%|                                       |
>= 0.778  <  0.944  |0n   0.00%|                                       |
>= 0.944  <  1.1099 |0n   0.00%|                                       |
>= 1.1099 <  1.2759 |0n   0.00%|                                       |
>= 1.2759 <  1.4419 |0n   0.00%|                                       |
>= 1.4419 <  1.6079 |0n   0.00%|                                       |
>= 1.6079 <  1.7739 |0n   0.00%|                                       |
>= 1.7739 <= 1.9399 |3n  37.50%|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■|

Compile time (hyperfine)

margin-account

Command Mean [s] Min [s] Max [s] Relative
master@08dad8c5 4.232 ± 0.073 4.184 4.315 1.00 ± 0.02
xunilrj/decrease-back-jmps@950bca7b 4.214 ± 0.033 4.188 4.251 1.00

order-book

Command Mean [s] Min [s] Max [s] Relative
master@08dad8c5 9.534 ± 0.210 9.372 9.772 1.00
xunilrj/decrease-back-jmps@950bca7b 11.677 ± 0.052 11.640 11.737 1.22 ± 0.03

@xunilrj
xunilrj marked this pull request as ready for review August 25, 2026 14:34
@xunilrj
xunilrj requested a review from a team as a code owner August 25, 2026 14:34
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