telemint icon indicating copy to clipboard operation
telemint copied to clipboard

[ IMPROVEMENT] Speeding up the check amount by a few milliseconds

Open Viktorianec opened this issue 1 year ago • 4 comments

We could check the balance after each operation, saving time for the calculation of a few milliseconds.

Viktorianec avatar Oct 22 '22 19:10 Viktorianec

كله تمام

11771100 avatar Oct 22 '22 19:10 11771100

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

bitspill avatar Oct 22 '22 19:10 bitspill

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

xssnick avatar Oct 22 '22 20:10 xssnick

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.

Viktorianec avatar Oct 22 '22 20:10 Viktorianec

There is no need to optimize queries that will eventually fail.

arseny30 avatar Oct 25 '22 14:10 arseny30