TelegramMessenger / telemint

Telegram Auction Platform smart contracts
GNU General Public License v3.0
337 stars 69 forks source link

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

Closed Viktorianec closed 1 year ago

Viktorianec commented 1 year ago

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

11771100 commented 1 year ago

كله تمام

bitspill commented 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

xssnick commented 1 year ago

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

Viktorianec commented 1 year ago

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.

arseny30 commented 1 year ago

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