Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Unanswered
What is the more gas efficient for this 2 type of code in FunC?

Case 1:

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
    slice cs = in_msg_full.begin_parse();
    int flags = cs~load_uint(4);
    if ((flags & 1) | (in_msg_body.slice_empty?())) {
        return ();
    }
    slice sender = cs~load_msg_addr();

    int op = in_msg_body~load_uint(32);
    ;;     (int op, int query_id) = (in_msg_body~load_uint(32), in_msg_body~load_uint(64));
    
    if (op == op::claim) {
        query_id = in_msg_body~load_uint(64);
				;; .....code..... ;; 
    }

    elseif (op == op::process_claim) {
        query_id = in_msg_body~load_uint(64);
				;; .....code..... ;; 
    }
}

Case2:

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
    slice cs = in_msg_full.begin_parse();
    int flags = cs~load_uint(4);
    if ((flags & 1) | (in_msg_body.slice_empty?())) {
        return ();
    }
    slice sender = cs~load_msg_addr();

    ;; int op = in_msg_body~load_uint(32);
		(int op, int query_id) = (in_msg_body~load_uint(32), in_msg_body~load_uint(64));
    
    if (op == op::claim) {
        ;; query_id = in_msg_body~load_uint(64);
				;; .....code..... ;; 
    }

    elseif (op == op::process_claim) {
					;; query_id = in_msg_body~load_uint(64);
				;; .....code..... ;; 
    }
}

As you can see, the difference is only calling the query_id = in_msg_body~load_uint(64) firstly or inside the if method. Should we notice the gas efficient at this moment?

  
  
Posted one year ago
Votes Newest

Answers

4K Views
0 Answers
one year ago
one year ago
Tags