Skip to content

perf: Skip redundant stack limit analysis - #16902

Open
sbillig wants to merge 1 commit into
argotorg:developfrom
sbillig:perf/stacklimit-skip
Open

perf: Skip redundant stack limit analysis#16902
sbillig wants to merge 1 commit into
argotorg:developfrom
sbillig:perf/stacklimit-skip

Conversation

@sbillig

@sbillig sbillig commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Skip running StackLimitEvader when StackCompressor determines that there are no stack-too-deep problems.
This avoids rebuilding the cfg, and repeating the same analysis.

It also avoids the rewriting of memoryguard literals from decimal to hex in the otherwise-noop case
that we now skip, hence the updated test output file changes. (Previously eg memoryguard(128) would be rewritten to memoryguard(0x80) unconditionally)

On Uniswap v4-core, this reduces allocation calls by 19.085M (−3.2071%) and requested bytes by 3.396 GB (−3.7172%).

Baseline: 0.8.37-ci.2026.8.6+commit.9b2f86be.Linux.g++ n=3
Target:   0.8.37-ci.2026.8.13+commit.7858cdc6.Linux.g++ n=3
Values are mean ± sample stddev. Δ% = (target mean - baseline mean) / baseline mean. Negative = improvement (lower is better), positive = regression.
winner = '~noise' unless the gap passes a Welch t-test and |Δ%| ≥ 0.1%.

Benchmark                Pipeline  Metric         Base                   Target                 Δ%      winner
-----------------------  --------  -------------  ---------------------  ---------------------  ------  --------
openzeppelin-5.6.1       evmasm    cpu_time       18.2369s ± 0.0193s     18.2746s ± 0.0101s     +0.21%  ~noise
                                   creation_size  725,287 ± 0            725,287 ± 0            0.0%    tie
                                   cycles         63.2694G ± 77.7217M    63.3187G ± 30.0288M    +0.08%  ~noise
                                   instructions   124.9823G ± 473        125.1079G ± 278        +0.1%   BASELINE
                                   peak_rss       1015 ± 0 MiB           1066 ± 0 MiB           +5.01%  BASELINE
                                   runtime_size   650,752 ± 0            650,752 ± 0            0.0%    tie
                                   wall_time      18.3659s ± 0.0175s     18.4003s ± 0.0087s     +0.19%  ~noise

openzeppelin-5.6.1       ir        cpu_time       52.1626s ± 0.0527s     50.3149s ± 0.0150s     -3.54%  TARGET
                                   creation_size  675,405 ± 0            675,405 ± 0            0.0%    tie
                                   cycles         184.5272G ± 174.2462M  177.9435G ± 44.9278M   -3.57%  TARGET
                                   instructions   300.9914G ± 1.1239k    288.9893G ± 426        -3.99%  TARGET
                                   peak_rss       1387 ± 0 MiB           1388 ± 0 MiB           +0.12%  BASELINE
                                   runtime_size   598,355 ± 0            598,355 ± 0            0.0%    tie
                                   wall_time      52.4456s ± 0.0532s     50.5925s ± 0.0165s     -3.53%  TARGET

solady-0.1.26            evmasm    cpu_time       25.4536s ± 0.0512s     25.4753s ± 0.0133s     +0.09%  ~noise
                                   creation_size  1,514,791 ± 0          1,514,791 ± 0          0.0%    tie
                                   cycles         87.5712G ± 174.8606M   87.7038G ± 57.2997M    +0.15%  ~noise
                                   instructions   182.2905G ± 222        182.4166G ± 352        +0.07%  ~noise
                                   peak_rss       1813 ± 0 MiB           1812 ± 0 MiB           -0.08%  ~noise
                                   runtime_size   1,480,154 ± 0          1,480,154 ± 0          0.0%    tie
                                   wall_time      25.6441s ± 0.0450s     25.6659s ± 0.0232s     +0.08%  ~noise

solady-0.1.26            ir        cpu_time       132.6701s ± 0.0816s    128.0828s ± 0.0517s    -3.46%  TARGET
                                   creation_size  1,681,895 ± 0          1,681,895 ± 0          0.0%    tie
                                   cycles         471.0342G ± 319.0700M  454.5971G ± 179.7754M  -3.49%  TARGET
                                   instructions   682.6695G ± 73         655.2556G ± 364        -4.02%  TARGET
                                   peak_rss       2785 ± 0 MiB           2786 ± 0 MiB           +0.06%  ~noise
                                   runtime_size   1,650,497 ± 0          1,650,497 ± 0          0.0%    tie
                                   wall_time      133.3793s ± 0.0978s    128.7534s ± 0.0557s    -3.47%  TARGET

prb-math-4.1.1           evmasm    cpu_time       6.6805s ± 0.0164s      6.6862s ± 0.0020s      +0.09%  ~noise
                                   creation_size  252,039 ± 0            252,039 ± 0            0.0%    tie
                                   cycles         21.4643G ± 67.4157M    21.4950G ± 22.8553M    +0.14%  ~noise
                                   instructions   45.7352G ± 136         45.7425G ± 97          +0.02%  ~noise
                                   peak_rss       1171 ± 0 MiB           1171 ± 0 MiB           0.0%    tie
                                   runtime_size   250,178 ± 0            250,178 ± 0            0.0%    tie
                                   wall_time      6.7311s ± 0.0226s      6.7406s ± 0.0108s      +0.14%  ~noise

prb-math-4.1.1           ir        cpu_time       26.8109s ± 0.0093s     26.2661s ± 0.0125s     -2.03%  TARGET
                                   creation_size  262,432 ± 0            262,432 ± 0            0.0%    tie
                                   cycles         93.2943G ± 37.6994M    91.3638G ± 44.0117M    -2.07%  TARGET
                                   instructions   145.0668G ± 428        141.6537G ± 295        -2.35%  TARGET
                                   peak_rss       1430 ± 0 MiB           1434 ± 0 MiB           +0.26%  BASELINE
                                   runtime_size   260,832 ± 0            260,832 ± 0            0.0%    tie
                                   wall_time      26.9518s ± 0.0044s     26.4058s ± 0.0115s     -2.03%  TARGET

forge-std-1.16.1         evmasm    cpu_time       8.0321s ± 0.0103s      8.0030s ± 0.0020s      -0.36%  TARGET
                                   creation_size  394,603 ± 0            394,603 ± 0            0.0%    tie
                                   cycles         27.6142G ± 32.9076M    27.5275G ± 3.6783M     -0.31%  TARGET
                                   instructions   54.8421G ± 248         54.8666G ± 83          +0.04%  ~noise
                                   peak_rss       542 ± 0 MiB            541 ± 0 MiB            -0.1%   TARGET
                                   runtime_size   381,729 ± 0            381,729 ± 0            0.0%    tie
                                   wall_time      8.0877s ± 0.0198s      8.0564s ± 0.0062s      -0.39%  ~noise

forge-std-1.16.1         ir        cpu_time       34.6354s ± 0.0248s     33.6999s ± 0.0142s     -2.7%   TARGET
                                   creation_size  422,073 ± 0            422,073 ± 0            0.0%    tie
                                   cycles         122.7875G ± 90.3700M   119.3914G ± 46.9614M   -2.77%  TARGET
                                   instructions   179.8147G ± 227        173.4876G ± 249        -3.52%  TARGET
                                   peak_rss       758 ± 0 MiB            783 ± 0 MiB            +3.24%  BASELINE
                                   runtime_size   406,750 ± 0            406,750 ± 0            0.0%    tie
                                   wall_time      34.8104s ± 0.0177s     33.8796s ± 0.0113s     -2.67%  TARGET

v4-core-4.0.0            evmasm    cpu_time       16.0804s ± 0.0128s     16.0955s ± 0.0229s     +0.09%  ~noise
                                   creation_size  2,012,188 ± 0          2,012,188 ± 0          0.0%    tie
                                   cycles         55.8132G ± 32.3274M    55.8782G ± 89.4153M    +0.12%  ~noise
                                   instructions   110.3795G ± 49         110.5018G ± 317        +0.11%  BASELINE
                                   peak_rss       861 ± 0 MiB            862 ± 0 MiB            +0.07%  ~noise
                                   runtime_size   1,983,262 ± 0          1,983,262 ± 0          0.0%    tie
                                   wall_time      16.1980s ± 0.0133s     16.2077s ± 0.0228s     +0.06%  ~noise

v4-core-4.0.0            ir        cpu_time       89.5287s ± 0.0238s     87.4018s ± 0.0392s     -2.38%  TARGET
                                   creation_size  1,804,635 ± 0          1,804,635 ± 0          0.0%    tie
                                   cycles         318.1867G ± 95.7863M   310.4663G ± 145.3140M  -2.43%  TARGET
                                   instructions   480.9478G ± 1.4668k    467.6325G ± 749        -2.77%  TARGET
                                   peak_rss       1617 ± 0 MiB           1615 ± 0 MiB           -0.11%  TARGET
                                   runtime_size   1,777,945 ± 0          1,777,945 ± 0          0.0%    tie
                                   wall_time      89.9842s ± 0.0219s     87.8462s ± 0.0410s     -2.38%  TARGET

morpho-blue-1.0.0        evmasm    cpu_time       9.2900s ± 0.0134s      9.3192s ± 0.0063s      +0.31%  BASELINE
                                   creation_size  802,290 ± 0            802,290 ± 0            0.0%    tie
                                   cycles         32.2336G ± 50.1880M    32.3484G ± 29.7335M    +0.36%  BASELINE
                                   instructions   65.0197G ± 222         65.0657G ± 180         +0.07%  ~noise
                                   peak_rss       542 ± 0 MiB            541 ± 0 MiB            -0.1%   TARGET
                                   runtime_size   798,085 ± 0            798,085 ± 0            0.0%    tie
                                   wall_time      9.3493s ± 0.0125s      9.3862s ± 0.0056s      +0.39%  BASELINE

morpho-blue-1.0.0        ir        cpu_time       51.1071s ± 0.0480s     50.9301s ± 0.0256s     -0.35%  TARGET
                                   creation_size  753,526 ± 0            753,526 ± 0            0.0%    tie
                                   cycles         181.6723G ± 178.6852M  181.0903G ± 95.9752M   -0.32%  TARGET
                                   instructions   263.1485G ± 560        261.4888G ± 117        -0.63%  TARGET
                                   peak_rss       875 ± 0 MiB            877 ± 0 MiB            +0.3%   BASELINE
                                   runtime_size   750,240 ± 0            750,240 ± 0            0.0%    tie
                                   wall_time      51.3653s ± 0.0442s     51.1889s ± 0.0261s     -0.34%  TARGET

seaport-1.6              evmasm    cpu_time       108.5253s ± 0.0631s    108.4212s ± 0.1191s    -0.1%   ~noise
                                   creation_size  13,568,823 ± 0         13,568,823 ± 0         0.0%    tie
                                   cycles         376.5852G ± 187.1832M  376.2774G ± 368.9030M  -0.08%  ~noise
                                   instructions   672.5458G ± 3.2772k    672.9423G ± 4.6918k    +0.06%  ~noise
                                   peak_rss       2644 ± 0 MiB           2637 ± 0 MiB           -0.28%  TARGET
                                   runtime_size   12,556,893 ± 0         12,556,893 ± 0         0.0%    tie
                                   wall_time      109.2112s ± 0.0648s    109.1029s ± 0.1351s    -0.1%   ~noise

solmate-6                evmasm    cpu_time       3.5026s ± 0.0027s      3.5026s ± 0.0053s      0.0%    tie
                                   creation_size  279,294 ± 0            279,294 ± 0            0.0%    tie
                                   cycles         12.1756G ± 9.7649M     12.1820G ± 16.1807M    +0.05%  ~noise
                                   instructions   24.8168G ± 181         24.8589G ± 60          +0.17%  BASELINE
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   272,389 ± 0            272,389 ± 0            0.0%    tie
                                   wall_time      3.5290s ± 0.0125s      3.5299s ± 0.0115s      +0.03%  ~noise

solmate-6                ir        cpu_time       18.7255s ± 0.0303s     17.9808s ± 0.0400s     -3.98%  TARGET
                                   creation_size  267,193 ± 0            267,193 ± 0            0.0%    tie
                                   cycles         66.5457G ± 106.5130M   63.8952G ± 138.5058M   -3.98%  TARGET
                                   instructions   98.4781G ± 228         94.0430G ± 357         -4.5%   TARGET
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   259,851 ± 0            259,851 ± 0            0.0%    tie
                                   wall_time      18.8164s ± 0.0300s     18.0685s ± 0.0398s     -3.97%  TARGET

solarray-a547630         evmasm    cpu_time       1.0186s ± 0.0025s      1.0130s ± 0.0025s      -0.55%  ~noise
                                   creation_size  4,474 ± 0              4,474 ± 0              0.0%    tie
                                   cycles         3.2251G ± 5.4466M      3.2026G ± 15.3649M     -0.7%   ~noise
                                   instructions   7.6376G ± 23           7.6265G ± 23           -0.15%  TARGET
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   3,992 ± 0              3,992 ± 0              0.0%    tie
                                   wall_time      1.0272s ± 0.0040s      1.0203s ± 0.0024s      -0.67%  ~noise

solarray-a547630         ir        cpu_time       1.1946s ± 0.0029s      1.1939s ± 0.0009s      -0.06%  ~noise
                                   creation_size  4,220 ± 0              4,220 ± 0              0.0%    tie
                                   cycles         3.8556G ± 9.4355M      3.8531G ± 1.6205M      -0.07%  ~noise
                                   instructions   8.7550G ± 32           8.7065G ± 10           -0.55%  TARGET
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   3,920 ± 0              3,920 ± 0              0.0%    tie
                                   wall_time      1.2033s ± 0.0028s      1.2024s ± 0.0011s      -0.08%  ~noise

solidity-verifier        evmasm    cpu_time       0.1060s ± 0.0002s      0.1063s ± 0.0003s      +0.29%  ~noise
                                   creation_size  4,790 ± 0              4,790 ± 0              0.0%    tie
                                   cycles         295.5401M ± 167.5773k  296.3735M ± 508.8326k  +0.28%  ~noise
                                   instructions   635.5532M ± 5          636.9812M ± 9          +0.22%  BASELINE
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   4,712 ± 0              4,712 ± 0              0.0%    tie
                                   wall_time      0.1070s ± 0.0002s      0.1072s ± 0.0003s      +0.18%  ~noise

solidity-verifier        ir        cpu_time       0.2218s ± 0.0002s      0.2147s ± 0.0001s      -3.2%   TARGET
                                   creation_size  4,215 ± 0              4,215 ± 0              0.0%    tie
                                   cycles         709.3663M ± 230.6292k  683.7439M ± 122.8496k  -3.61%  TARGET
                                   instructions   1.3577G ± 32           1.3102G ± 8            -3.5%   TARGET
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   4,161 ± 0              4,161 ± 0              0.0%    tie
                                   wall_time      0.2233s ± 0.0004s      0.2161s ± 0.0002s      -3.21%  TARGET

solidity-optimizor-club  ir        cpu_time       1.0816s ± 0.0020s      1.0491s ± 0.0017s      -3.01%  TARGET
                                   creation_size  21,778 ± 0             21,778 ± 0             0.0%    tie
                                   cycles         3.7407G ± 5.2469M      3.6258G ± 6.8670M      -3.07%  TARGET
                                   instructions   7.0230G ± 45           6.7913G ± 23           -3.3%   TARGET
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   20,616 ± 0             20,616 ± 0             0.0%    tie
                                   wall_time      1.0874s ± 0.0019s      1.0546s ± 0.0018s      -3.01%  TARGET

solidity-chains          evmasm    cpu_time       0.1113s ± 0.0002s      0.1116s ± 0.0005s      +0.28%  ~noise
                                   creation_size  5,831 ± 0              5,831 ± 0              0.0%    tie
                                   cycles         317.8958M ± 567.3079k  318.6019M ± 694.3545k  +0.22%  ~noise
                                   instructions   650.1319M ± 11         651.3160M ± 11         +0.18%  BASELINE
                                   peak_rss       848 ± 0 MiB            848 ± 0 MiB            +0.01%  ~noise
                                   runtime_size   5,803 ± 0              5,803 ± 0              0.0%    tie
                                   wall_time      0.1121s ± 0.0003s      0.1124s ± 0.0006s      +0.23%  ~noise
                                   ```

## Checklist
- [x] I have read the [contributing guidelines](https://docs.soliditylang.org/en/latest/contributing.html) and the [review checklist](https://github.com/argotorg/solidity/blob/develop/ReviewChecklist.md)
- [x] I have personally reviewed, understood, and tested every change in this PR

## AI Disclosure

gpt 5.6 sol xhigh for everything

@sbillig
sbillig force-pushed the perf/stacklimit-skip branch from ac71a09 to 7858cdc Compare August 13, 2026 02:35
@sbillig
sbillig marked this pull request as ready for review August 13, 2026 19:36
@sbillig sbillig changed the title Skip redundant stack limit analysis perf: Skip redundant stack limit analysis Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant