Skip to content

Commit

Permalink
Fixed calculations in table (type in origin amount)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skydev0h committed Nov 2, 2023
1 parent 33c4e87 commit 5709f2a
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions Improvements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@ total level, with further commits do a ``stable development`` of contest test ca
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| .____________________________________________________________. | Ext | Int | Extn | Total | Save | Perc% | Exter | Inter | Exten | Total |
+================================================================+======+======+======+=======+======+=======+=======+=======+=======+========+
| *Origin point: INITIAL* | 3235 | 4210 | 2760 | 10250 | 0 | 0.00% | 64038 | 71163 | 38866 | 174067 |
| *Origin point: INITIAL* | 3235 | 4210 | 2760 | 10205 | 0 | 0.00% | 64038 | 71163 | 38866 | 174067 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Optimized unneccessary cell loads and operations | 3185 | 4014 | 2744 | 9943 | 262 | 2.56% | 65556 | 70764 | 40304 | 176624 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Removed unneccessary always true check | 3185 | 3823 | 2501 | 9509 | 741 | 7.23% | 65504 | 68993 | 38998 | 173495 |
| Removed unneccessary always true check | 3185 | 3823 | 2501 | 9509 | 696 | 6.82% | 65504 | 68993 | 38998 | 173495 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Unrolled the common internal handler code | 3185 | 3700 | 2373 | 9258 | 992 | 9.68% | 65504 | 67886 | 38204 | 171594 |
| Unrolled the common internal handler code | 3185 | 3700 | 2373 | 9258 | 947 | 9.28% | 65504 | 67886 | 38204 | 171594 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Implicitly return from the external handler | 3165 | 3700 | 2373 | 9238 | 1012 | 9.87% | 65264 | 67886 | 38204 | 171354 |
| Implicitly return from the external handler | 3165 | 3700 | 2373 | 9238 | 967 | 9.48% | 65264 | 67886 | 38204 | 171354 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Reaped benefits of separated internal loaders | 3165 | 3700 | 2295 | 9160 | 1090 | 10.6% | 65264 | 67886 | 37736 | 170886 |
| Reaped benefits of separated internal loaders | 3165 | 3700 | 2295 | 9160 | 1045 | 10.2% | 65264 | 67886 | 37736 | 170886 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Discarded unneccessary slice remains in dispatcher | 3155 | 3690 | 2285 | 9130 | 1120 | 10.9% | 65034 | 67716 | 37646 | 170396 |
| Discarded unneccessary slice remains in dispatcher | 3155 | 3690 | 2285 | 9130 | 1075 | 10.5% | 65034 | 67716 | 37646 | 170396 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Loaded auth_kind optionally using LDUQ instruction | 3155 | 3654 | 2249 | 9058 | 1192 | 11.6% | 65050 | 67408 | 37430 | 169888 |
| Loaded auth_kind optionally using LDUQ instruction | 3155 | 3654 | 2249 | 9058 | 1147 | 11.2% | 65050 | 67408 | 37430 | 169888 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Is ifnot a joke for you? (emits less instructions) | 3155 | 3654 | 2231 | 9040 | 1210 | 11.8% | 65050 | 67408 | 37322 | 169780 |
| Is ifnot a joke for you? (emits less instructions) | 3155 | 3654 | 2231 | 9040 | 1165 | 11.4% | 65050 | 67408 | 37322 | 169780 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Localize extensions in loop and short-circ simple | 3045 | 3644 | 2121 | 8810 | 1440 | 14.0% | 69697 | 71316 | 39314 | 180327 |
| Localize extensions in loop and short-circ simple | 3045 | 3644 | 2121 | 8810 | 1395 | 13.7% | 69697 | 71316 | 39314 | 180327 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Reordering int msg handlers somehow saves 10 gas | 3045 | 3567 | 2188 | 8800 | 1450 | 14.1% | 69697 | 70623 | 39716 | 180036 |
| Reordering int msg handlers somehow saves 10 gas | 3045 | 3567 | 2188 | 8800 | 1405 | 13.8% | 69697 | 70623 | 39716 | 180036 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Moving signature check higher saves some gas | 3027 | 3549 | 2188 | 8764 | 1486 | 14.5% | 69481 | 70461 | 39716 | 179658 |
| Moving signature check higher saves some gas | 3027 | 3549 | 2188 | 8764 | 1441 | 14.1% | 69481 | 70461 | 39716 | 179658 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Reordering checks somehow sames some more gas | 3009 | 3531 | 2188 | 8728 | 1522 | 14.8% | 69265 | 70299 | 39716 | 179280 |
| Reordering checks somehow sames some more gas | 3009 | 3531 | 2188 | 8728 | 1477 | 14.5% | 69265 | 70299 | 39716 | 179280 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Removing end_parse is -gas and +reliability | 2983 | 3505 | 2188 | 8676 | 1574 | 15.6% | 68953 | 70065 | 39716 | 178734 |
| Removing end_parse is -gas and +reliability | 2983 | 3505 | 2188 | 8676 | 1529 | 15.0% | 68953 | 70065 | 39716 | 178734 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Keep your functions close and vars even closer | 2957 | 3505 | 2188 | 8650 | 1600 | 15.6% | 68641 | 70065 | 39716 | 178422 |
| Keep your functions close and vars even closer | 2957 | 3505 | 2188 | 8650 | 1555 | 15.2% | 68641 | 70065 | 39716 | 178422 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| < restore extensions var in loop > | 3067 | 3533 | 2288 | 8888 | | | 65669 | 67568 | 38456 | |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
Expand All @@ -59,19 +59,19 @@ total level, with further commits do a ``stable development`` of contest test ca
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| < optimize preference for simple ext ops > | 2957 | 3423 | 2248 | 8628 | | | 65528 | 67495 | 39324 | |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Refactored internal message flows, good GGC value | 2957 | 3423 | 2248 | 8628 | 1622 | 15.8% | 65528 | 67495 | 39324 | 172347 |
| Refactored internal message flows, good GGC value | 2957 | 3423 | 2248 | 8628 | 1577 | 15.5% | 65528 | 67495 | 39324 | 172347 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| ^^^ This commit finally shows TOTAL GGC less then initial one WHILE providing 15.8% gas save on contest test cases! ^^^ |
| ^^^ This commit finally shows TOTAL GGC less then initial one WHILE providing 15.5% gas save on contest test cases! ^^^ |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Reorganized inlining point for extension message flow | 2957 | 3423 | 2230 | 8610 | 1640 | 16.0% | 65528 | 67495 | 38782 | 171805 |
| Reorganized inlining point for extension message flow | 2957 | 3423 | 2230 | 8610 | 1595 | 15.6% | 65528 | 67495 | 38782 | 171805 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Do not carry around params not needed (ext opt) | 2957 | 3423 | 2176 | 8556 | 1694 | 16.5% | 65176 | 67275 | 38586 | 171037 |
| Do not carry around params not needed (ext opt) | 2957 | 3423 | 2176 | 8556 | 1649 | 16.2% | 65176 | 67275 | 38586 | 171037 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Optimize argument order to match stack | 2939 | 3405 | 2148 | 8492 | 1758 | 17.2% | 64960 | 67113 | 38346 | 170419 |
| Optimize argument order to match stack | 2939 | 3405 | 2148 | 8492 | 1713 | 16.8% | 64960 | 67113 | 38346 | 170419 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Swapping extn and sign order back saves some net gas | 2939 | 3464 | 2063 | 8466 | 1784 | 17.4% | 65004 | 67676 | 37876 | 170556 |
| Swapping extn and sign order back saves some net gas | 2939 | 3464 | 2063 | 8466 | 1739 | 17.0% | 65004 | 67676 | 37876 | 170556 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Short-circuit optimization of LDUQ with IFNOTRET | 2939 | 3420 | 2019 | 8378 | 1872 | 18.3% | 64929 | 67205 | 37612 | 169746 |
| Short-circuit optimization of LDUQ with IFNOTRET | 2939 | 3420 | 2019 | 8378 | 1827 | 17.9% | 64929 | 67205 | 37612 | 169746 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| < short-circuit flags check with asm > | 2939 | 3402 | 2001 | 8342 | | | | | | |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
Expand All @@ -81,39 +81,39 @@ total level, with further commits do a ``stable development`` of contest test ca
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| < short-circuit extension dictionary check with asm > | 2913 | 3376 | 1983 | 8272 | | | | | | |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Short-circuited some returns with asm | 2913 | 3376 | 1983 | 8272 | 1978 | 19.3% | 64599 | 66791 | 37373 | 168763 |
| Short-circuited some returns with asm | 2913 | 3376 | 1983 | 8272 | 1933 | 18.9% | 64599 | 66791 | 37373 | 168763 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| ASM-optimized simple action cases | 2885 | 3348 | 1981 | 8214 | 2036 | 19.9% | 64470 | 66700 | 37351 | 168521 |
| ASM-optimized simple action cases | 2885 | 3348 | 1981 | 8214 | 1991 | 19.5% | 64470 | 66700 | 37351 | 168521 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Optimized out more unneeded instructions if may RET | 2885 | 3338 | 1955 | 8178 | 2072 | 20.2% | 64470 | 66610 | 37177 | 168257 |
| Optimized out more unneeded instructions if may RET | 2885 | 3338 | 1955 | 8178 | 2027 | 19.9% | 64470 | 66610 | 37177 | 168257 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| ^^^ Finally got more than **20%** optimization in test cases! ^^^ |
| Removed another unneccessary DROP with preload uint | 2875 | 3338 | 1955 | 8168 | 2037 | 20.0% | 64350 | 66610 | 37177 | 168137 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Removed another unneccessary DROP with preload uint | 2875 | 3338 | 1955 | 8168 | 2082 | 20.3% | 64350 | 66610 | 37177 | 168137 |
| ^^^ Finally got **20%** optimization in test cases! ^^^ |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Reordered argument order to optimize stack operations | 2857 | 3320 | 1955 | 8132 | 2118 | 20.7% | 64134 | 66448 | 37137 | 167719 |
| Reordered argument order to optimize stack operations | 2857 | 3320 | 1955 | 8132 | 2073 | 20.3% | 64134 | 66448 | 37137 | 167719 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Rewritten RETALT to IFNOTJMP - less gas, more reliable | 2836 | 3299 | 1934 | 8069 | 2181 | 21.3% | 64071 | 66406 | 37220 | 167697 |
| Rewritten RETALT to IFNOTJMP - less gas, more reliable | 2836 | 3299 | 1934 | 8069 | 2136 | 20.9% | 64071 | 66406 | 37220 | 167697 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Another argument stack optimization (psr -> dr call) | 2818 | 3281 | 1934 | 8033 | 2217 | 21.6% | 64017 | 66370 | 37220 | 167607 |
| Another argument stack optimization (psr -> dr call) | 2818 | 3281 | 1934 | 8033 | 2172 | 21.3% | 64017 | 66370 | 37220 | 167607 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| ^^^ Finally this solution is better then original in **EVERY** test suite branch! The last hurdle - Exter GGC is now less!!! ^^^ |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Black magic route optimization (drop some result later) | 2818 | 3281 | 1916 | 8015 | 2235 | 21.8% | 64017 | 66370 | 37130 | 167517 |
| Black magic route optimization (drop some result later) | 2818 | 3281 | 1916 | 8015 | 2190 | 21.5% | 64017 | 66370 | 37130 | 167517 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Another black magic optimization (drop auth_kind later) | 2818 | 3281 | 1906 | 8005 | 2245 | 21.9% | 64017 | 66370 | 37102 | 167489 |
| Another black magic optimization (drop auth_kind later) | 2818 | 3281 | 1906 | 8005 | 2200 | 21.6% | 64017 | 66370 | 37102 | 167489 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Backported FunC optimizations from entrypoint branch | 2782 | 3373 | 1824 | 7979 | 2245 | 22.1% | 60011 | 64810 | 34138 | 158959 |
| Backported FunC optimizations from entrypoint branch | 2782 | 3373 | 1824 | 7979 | 2226 | 21.8% | 60011 | 64810 | 34138 | 158959 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Use SDBEGINS to enforce prefix in external message | 2710 | 3373 | 1824 | 7907 | 2343 | 22.9% | 59147 | 64810 | 34138 | 158095 |
| Use SDBEGINS to enforce prefix in external message | 2710 | 3373 | 1824 | 7907 | 2298 | 22.5% | 59147 | 64810 | 34138 | 158095 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Use SDBEGINSQ to check internal message prefixes | 2710 | 3283 | 1736 | 7729 | 2521 | 24.6% | 59237 | 64090 | 33578 | 156905 |
| Use SDBEGINSQ to check internal message prefixes | 2710 | 3283 | 1736 | 7729 | 2476 | 24.3% | 59237 | 64090 | 33578 | 156905 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Backport some optimizations from EP and coalesce code | 2699 | 3165 | 1828 | 7692 | 2558 | 25.0% | 59108 | 63031 | 34141 | 156280 |
| Backport some optimizations from EP and coalesce code | 2699 | 3165 | 1828 | 7692 | 2513 | 24.6% | 59108 | 63031 | 34141 | 156280 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Optimized instructions order for extension and fix args | 2699 | 3165 | 1810 | 7674 | 2576 | 25.1% | 59108 | 63031 | 34033 | 156172 |
| Optimized instructions order for extension and fix args | 2699 | 3165 | 1810 | 7674 | 2531 | 24.8% | 59108 | 63031 | 34033 | 156172 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| *Reminder and origin point: INITIAL* | 3235 | 4210 | 2760 | 10250 | 0 | 0.00% | 64038 | 71163 | 38866 | 174067 |
| *Reminder and origin point: INITIAL* | 3235 | 4210 | 2760 | 10205 | 0 | 0.00% | 64038 | 71163 | 38866 | 174067 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+

*It seems that backporting optimization wiggles around values here and there.* To get the maximum possible gas savings please consider taking
Expand Down

0 comments on commit 5709f2a

Please sign in to comment.