Skip to content

Commit

Permalink
Black magic route optimization (drop some result later)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skydev0h committed Oct 10, 2023
1 parent 8e5696b commit f77dded
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Improvements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Improvements log
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Another argument stack optimization (psr -> dr call) | 2818 | 3281 | 1934 | 8033 | 2217 | 21.6% | 64017 | 66370 | 37220 | 167607 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| Black magic route optimization (drop some result later) | 2818 | 3281 | 1916 | 8015 | 2235 | 21.8% | 64017 | 66370 | 37130 | 167517 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+
| *Reminder and origin point: INITIAL* | 3235 | 4210 | 2760 | 10250 | 0 | 0.00% | 64038 | 71163 | 38866 | 174067 |
+----------------------------------------------------------------+------+------+------+-------+------+-------+-------+-------+-------+--------+

Expand Down
10 changes: 7 additions & 3 deletions contracts/wallet_v5.fc
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,22 @@ int pack_address(int wc, int hash) impure asm "SWAP INC XOR"; ;; hash ^ (wc+1)
}
-}
set_actions_if_simple(cs);
;; <<<<<<<<<<---------- CONTEST TEST CUTOFF POINT ---------->>>>>>>>>>
;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;; ------------------------------------------ INLINING BOUNDARY ------------------------------------------
dispatch_complex_request_iref(stored_seqno, cs, immutable_tail, stored_subwallet, public_key);
}

() dispatch_extension_request(slice cs) impure inline {
() dispatch_extension_request(slice cs, var dummy) impure inline {
{-
ifnot (cs.preload_uint(1)) {
set_actions(cs.preload_ref());
return ();
}
-}
set_actions_if_simple(cs);
dummy~impure_touch(); ;; DROP merged to 2DROP!
;; <<<<<<<<<<---------- CONTEST TEST CUTOFF POINT ---------->>>>>>>>>>
var ds = get_data().begin_parse();
var stored_seqno = ds~load_uint(32);
var immutable_tail = ds; ;; stored_subwallet ~ public_key ~ extensions
Expand Down Expand Up @@ -210,8 +213,9 @@ int pack_address(int wc, int hash) impure asm "SWAP INC XOR"; ;; hash ^ (wc+1)
}
-}
;; return_if_not(success?);
extensions.udict_get_or_return(256, packed_sender_addr);
dispatch_extension_request(body); ;; Special route for external address authenticated request
var dummy = extensions.udict_get_or_return(256, packed_sender_addr);
;; dummy is for black magic optimization. will drop it later with 2drop
dispatch_extension_request(body, dummy); ;; Special route for external address authenticated request
return ();

}
Expand Down

0 comments on commit f77dded

Please sign in to comment.