Closed Viktorianec closed 1 year ago
كله تمام
While this may speed up the case in which there are not_enough_funds, doesn't it slow down the more common case that there are sufficient funds?
Thus the net effect is instead an overall slowdown due to the 2 additional checks; also increasing gas costs for end users
throw_unless
operation costs 26 or 76 gas + additional compare op, math operations costs 18 gas, so it will cost more than before I think
throw_unless
operation costs 26 or 76 gas + additional compare op, math operations costs 18 gas, so it will cost more than before I think
Thanks for the comment. I was focusing on speed, not cost. If the cost priority is exceeded, I will try to focus on other problems.
There is no need to optimize queries that will eventually fail.
We could check the balance after each operation, saving time for the calculation of a few milliseconds.